Option Strict Off
Option Explicit On
Friend Class game
	Inherits System.Windows.Forms.Form
	Private Declare Function ShellExecute Lib "shell32.dll"  Alias "ShellExecuteA"(ByVal hwnd As Integer, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer
	Private Declare Function PlaySound Lib "winmm.dll"  Alias "PlaySoundA"(ByVal lpszName As String, ByVal hModule As Integer, ByVal dwFlags As Integer) As Integer
	
	
	' constants
	Dim player_names(6) As String
	Dim num_players As Short
	Dim num_piles_to_exhaust As Short
	Dim num_actions As Short
	Dim action_count As Short
	Dim victory_count As Short
	
	' zones
	Dim deck(6, 100) As Short
	Dim hand(6, 100) As Short
	Dim discard(6, 100) As Short
	Dim limbo(6, 100) As Short
	Dim native_village(6, 100) As Short
	Dim island(6, 100) As Short
	Dim haven(6, 100) As Short
	
	' game state
	Dim action_cards(13) As Short
	Dim pile_size(100) As Short
	Dim embargo(100) As Short
	Dim id_by_pile(100) As Short
	Dim buys, coins, actions As Object
	Dim potions_avail As Short
	Dim phase As String
	Dim active_player As Short
	Dim current_limbo_count As Short
	Dim remodel_cost As Object
	Dim remodel_potions As Short
	Dim win_streak As Short
	Dim bought_coins, bought_curses As Object
	Dim bought_actions As Short
	Dim bought_vp As Short
	Dim did_anything As Short
	Dim game_ended As Short
	Dim throne_copies, throne_card As Object
	Dim throne_original_played As Short
	Dim turn_order(6) As Short
	Dim durations_played(6, 100) As Short
	Dim discard_counter As Short
	Dim gained(6, 100) As Short
	Dim coin_tokens(6) As Object
	Dim limbo_count_at_start As Short
	Dim bridges_played As Short
	Dim taking_extra_turn As Object
	Dim going_to_take_extra_turn As Short
	Dim actions_played As Short
	Dim coppersmith_played As Short
	Dim secret_chamber_count As Object
	Dim current_action As Short
	Dim max_player As Short
	Dim vps(6) As Short
	Dim hidden(100) As Short
	Dim golem_card As Object
	Dim doing_golem As Short
	Dim bridge_built, herbalist_complete As Object
	Dim possessed As Short
	Dim potions_played As Short
	
	
	Public Sub start_game()
		num_players = CShort(settings.comboNumPlayers.Text)
		num_piles_to_exhaust = CShort(settings.comboExhaust.Text)
		num_actions = CShort(settings.comboNumActions.Text)
		victory_count = CShort(settings.comboNumVictory.Text)
		action_count = CShort(settings.comboNumEachAction.Text)
		Call scenario_start_game()
		
		game_ended = 0
		lblTurn.Text = CStr(0)
		txtLog.Text = ""
		
		lblVillage.Visible = False
		lblVillageCards.Text = ""
		lblVillageCards.Visible = False
		lblCoinTokens.Visible = False
		lblCoinTokens.Text = ""
		lblCoinTokenText.Visible = False
		
		' achievement conditions
		'UPGRADE_WARNING: Couldn't resolve default property of object bought_curses. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		bought_curses = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object bought_coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		bought_coins = 0
		bought_actions = 0
		did_anything = 0
		max_player = -1
		
		Dim i As Object
		Dim j As Short
		' hide details for people not playing
		For i = 0 To num_players - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			player_names(i) = settings.txtName(i).Text
			lblOpponent(i).Visible = True
			lblHands(i).Visible = True
			lblDiscard(i).Visible = True
			lblDeck(i).Visible = True
		Next i
		For i = num_players To 5
			lblOpponent(i).Visible = False
			lblHands(i).Visible = False
			lblDiscard(i).Visible = False
			lblDeck(i).Visible = False
		Next i
		
		' clear arrays
		For j = 0 To num_players - 1
			haven(j, 0) = -1
			'UPGRADE_WARNING: Couldn't resolve default property of object coin_tokens(j). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			coin_tokens(j) = 0
			deck(j, 10) = -1
			island(j, 0) = -1
			discard(j, 0) = -1
			hand(j, 0) = -1
			limbo(j, 0) = -1
			durations_played(j, 0) = -1
			native_village(j, 0) = -1
			gained(j, 0) = -1
		Next j
		
		'give everyone their opening hand of 7 copper and 3 estates
		For j = 0 To num_players - 1
			For i = 0 To 6
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				deck(j, i) = 0
			Next i
			deck(j, 7) = 3
			deck(j, 8) = 3
			deck(j, 9) = 3
			shuffle_deck((j))
			Call draw_cards(j, 5)
			
		Next j
		
		Call scenario_start_game()
		
		Call pick_actions()
		Call update_button_text()
		Call refresh_lists()
		
		active_player = Int(Rnd() * num_players)
		If Campaign.scenario_selected = 2 Then active_player = 1
		
		For i = 0 To num_players - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			turn_order((active_player + i) Mod num_players) = i
		Next i
		
		active_player = 0
		'hand(2, 0) = get_id_by_name("Envoy")
		'hand(2, 1) = get_id_by_name("Throne Room")
		'hand(0, 4) = get_id_by_name("Throne Room")
		'hand(0, 7) = -1
		'hand(0, 5) = 0
		'hand(1, 0) = get_id_by_name("Familiar")
		'hand(2, 1) = get_id_by_name("Swindler")
		'hand(0, 1) = get_id_by_name("University")
		'hand(0, 1) = get_id_by_name("Thief")
		'hand(0, 2) = get_id_by_name("Village")
		'hand(1, 3) = get_id_by_name("Thief")
		'hand(0, 4) = get_id_by_name("Potion")
		'hand(0, 1) = get_id_by_name("Herbalist")
		'hand(1, 2) = get_id_by_name("Golem")
		'hand(1, 0) = get_id_by_name("Throne Room")
		'deck(0, 5) = get_id_by_name("Throne Room")
		'deck(0, 10) = -1
		'deck(1, 0) = get_id_by_name("Phil's Stone")
		'deck(1, 1) = get_id_by_name("Silver")
		'deck(1, 4) = get_id_by_name("Feast")
		'deck(2, 0) = get_id_by_name("Gold")
		'hand(3, 4) = get_id_by_name("Village")
		'hand(1, 1) = get_id_by_name("Witch")
		'pile_size(get_id_by_name("Gold")) = 0
		
		
		Call start_turn()
		Call play_game()
		
	End Sub
	
	Private Sub cmdContinue_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdContinue.Click
		phase = "cleanupAI"
		Call hide_choices()
		Call play_game()
	End Sub
	
	Private Sub lblNext_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lblNext.Click
		Call imgNext_Click(imgNext, New System.EventArgs())
	End Sub
	Private Sub imgNext_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles imgNext.Click
		'MsgBox "phase = " & phase
		hide_next()
		Dim j As Short
		If phase = "action" Then
			move_to_buy_phase((0))
		ElseIf phase = "buy" Then 
			Call cleanup()
		ElseIf phase = "cellar" Then 
			Call draw_cards(active_player, CShort(imgNext.Tag))
			phase = "action"
			Call play_game()
		ElseIf phase = "herbalist" Then 
			Call cleanup()
		ElseIf phase = "secret_chamber" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(0, coins + imgNext.Tag)
			phase = "action"
			Call play_game()
		ElseIf phase = "saboteur" Then 
			For j = 0 To CInt(imgWhite.Tag)
				imgOpponentPlayed(j).Visible = True
			Next j
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call add_ai_play(get_id_by_name("Saboteur"), 0)
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call play_card_specific_action(get_id_by_name("Saboteur"))
			Call hide_prompt()
			
			Call play_game()
		Else
			phase = "action"
			Call play_game()
		End If
	End Sub
	
	Private Sub hide_next()
		imgNext.Visible = False
		lblNext.Visible = False
	End Sub
	
	'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
	Private Sub show_next(ByVal str_Renamed As String)
		imgNext.Visible = True
		lblNext.Visible = True
		lblNext.Text = str_Renamed
		imgNext.Tag = 0
	End Sub
	
	
	Private Sub lblSupplyTitle_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lblSupplyTitle.Click
		Dim Index As Short = lblSupplyTitle.GetIndex(eventSender)
		Call imgSupply_Click(imgSupply.Item(Index), New System.EventArgs())
	End Sub
	Private Sub lblSupplyCost_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lblSupplyCost.Click
		Dim Index As Short = lblSupplyCost.GetIndex(eventSender)
		Call imgSupply_Click(imgSupply.Item(Index), New System.EventArgs())
	End Sub
	Private Sub lblSupplyLeft_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lblSupplyLeft.Click
		Dim Index As Short = lblSupplyLeft.GetIndex(eventSender)
		Call imgSupply_Click(imgSupply.Item(Index), New System.EventArgs())
	End Sub
	Private Sub imgSupply_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles imgSupply.Click
		Dim Index As Short = imgSupply.GetIndex(eventSender)
		Dim which_card, i As Object
		Dim cost As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		which_card = Index
		If Index > 6 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			which_card = action_cards(Index - 7)
		End If
		load_picture((which_card))
		
		
		' allow buying if we can afford the card
		'Call append(0, "Phase: " & phase & " costs = " & costs(which_card) & " pile size = " & pile_size(which_card))
		'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If phase = "buy" And coins >= costs(which_card) And potions_avail >= potions(which_card) And buys > 0 And pile_size(which_card) > 0 Then
			If CDbl(lblTurn.Text) < 16 Then did_anything = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object bought_coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If gold(which_card) > 0 Then bought_coins = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If is_action(which_card) > 0 Then bought_actions = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call buy_card(which_card)
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "feast" And costs(which_card) < 6 And pile_size(which_card) > 0 And potions(which_card) = 0 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call gain_card(0, which_card)
			Call resume_actions()
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "ironworks" And costs(which_card) < 5 And pile_size(which_card) > 0 And potions(which_card) = 0 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call gain_card(0, which_card)
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If is_action(which_card) Then Call set_actions(active_player, actions + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If gold(which_card) > 0 Then Call set_coins(active_player, coins + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If victory_points(which_card) > 0 Then Call draw_cards(active_player, 1)
			Call resume_actions()
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "workshop" And costs(which_card) < 5 And pile_size(which_card) > 0 And potions(which_card) = 0 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call gain_card(0, which_card)
			Call resume_actions()
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "university" And costs(which_card) <= 5 And potions(which_card) = 0 And is_action(which_card) = 1 And pile_size(which_card) > 0 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call gain_card(0, which_card)
			Call resume_actions()
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "upgrade2" And costs(which_card) = remodel_cost And pile_size(which_card) > 0 And potions(which_card) = remodel_potions Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call gain_card(0, which_card)
			Call resume_actions()
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "saboteur" And costs(which_card) <= remodel_cost And pile_size(which_card) > 0 And potions(which_card) <= remodel_potions Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call gain_card(0, which_card)
			Call imgNext_Click(imgNext, New System.EventArgs())
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "remodel2" And costs(which_card) <= remodel_cost And pile_size(which_card) > 0 And potions(which_card) <= remodel_potions Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call gain_card(active_player, which_card)
			Call resume_actions()
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "mine2" And costs(which_card) <= remodel_cost And pile_size(which_card) > 0 And gold(which_card) > 0 And potions(which_card) <= remodel_potions Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call gain_card_to_hand(active_player, which_card)
			Call resume_actions()
		ElseIf phase = "embargo" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			embargo(which_card) = embargo(which_card) + 1
			Call update_button_text()
			Call resume_actions()
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "swindler" And pile_size(which_card) > 0 And costs(which_card) = Val(lblPrompt2.Tag) And potions(which_card) = remodel_potions Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call gain_card(CShort(lblPrompt.Tag), which_card)
			For i = CDbl(lblPrompt.Tag) + 1 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(i) = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call draw_cards(i, 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					cost = costs(hand(i, hand_count(i) - 1))
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					remodel_potions = potions(hand(i, hand_count(i) - 1))
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call trash_card_from_hand(i, hand_count(i) - 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object find_worst_card_for_cost(cost, remodel_potions). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If find_worst_card_for_cost(cost, remodel_potions) > -1 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lblPrompt.Tag = i
						lblPrompt2.Tag = cost
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						lblPrompt.Text = "Choose a card to give " & player_names(i) & " that costs " & cost
						If remodel_potions > 0 Then
							lblPrompt.Text = lblPrompt.Text & "+P"
						End If
						Exit Sub
					End If
				End If
			Next i
			Call resume_actions()
		ElseIf phase = "wishing_well" Then 
			Call append(player_names(0) & " reveals " & names(deck(0, 0)))
			'UPGRADE_WARNING: Couldn't resolve default property of object which_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If deck(0, 0) = which_card Then
				Call draw_cards(0, 1)
			End If
			Call resume_actions()
		End If
	End Sub
	
	Private Sub buy_card(ByVal card As Short)
		If active_player = 0 And card = 6 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object bought_curses. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			bought_curses = bought_curses + 1
		End If
		
		' if there is an embargo on this item, give out some curses
		Dim i As Short
		If embargo(card) > 0 Then
			For i = 0 To embargo(card) - 1
				Call gain_card(active_player, 6)
			Next i
		End If
		
		'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		Call set_coins(active_player, coins - costs(card))
		potions_avail = potions_avail - potions(card)
		'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		Call set_buys(active_player, buys - 1)
		Call gain_card(active_player, card)
		
		If victory_points(card) > 0 Then bought_vp = 1
		
		If names(card) = "Province" And active_player <> 0 Then
			Call play_sound("buy_province.wav")
		ElseIf pile_size(card) = 0 Then 
			Call play_sound("pile_empty.wav")
		End If
		
		'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If buys = 0 And active_player = 0 And settings.chkAutoEnd.CheckState = 1 Then
			Call hide_next()
			Call cleanup()
		End If
	End Sub
	
	
	Private Sub game_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Call initialize_cards()
		
		' initialize the hand images
		Dim i As Short
		For i = 0 To 40
			If i > imgHand.UBound Then
				imgHand.Load(i)
			End If
			imgHand(i).Visible = False
			imgHand(i).SetBounds(imgHand(0).Left, VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgHand(0).Top) + 400 * i), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y) 'you must determine where you want it
			If i > 6 Then
				imgHand(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgHand(0).Left) + 400), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgHand(0).Top) + 400 * (i - 6) - 200), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			End If
			imgHand(i).BringToFront()
			imgHand(i).Tag = -1
		Next i
		
		' initialize limbo images
		For i = 0 To 40
			If i > imgLimbo.UBound Then
				imgLimbo.Load(i)
			End If
			imgLimbo(i).Visible = False
			imgLimbo(i).SetBounds(imgLimbo(0).Left, VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgLimbo(0).Top) + 400 * i), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y) 'you must determine where you want it
			If i > 6 Then
				imgLimbo(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgLimbo(0).Left) + 400), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgLimbo(0).Top) + 400 * (i - 6) - 200), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			End If
			imgLimbo(i).BringToFront()
			imgLimbo(i).Tag = -1
		Next i
		
		' initialize choice images
		For i = 0 To 40
			If i > imgChoice.UBound Then
				imgChoice.Load(i)
			End If
			imgChoice(i).Visible = False
			imgChoice(i).SetBounds(imgChoice(0).Left, VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgChoice(0).Top) + 400 * i), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			If i > 3 Then
				imgChoice(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgChoice(0).Left) + 2400), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgChoice(0).Top) + 400 * (i - 4)), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			End If
			imgChoice(i).BringToFront()
			imgChoice(i).Tag = -1
		Next i
		
		' initialize opponent played images
		For i = 0 To 40
			If i > imgOpponentPlayed.UBound Then
				imgOpponentPlayed.Load(i)
			End If
			imgOpponentPlayed(i).Visible = False
			imgOpponentPlayed(i).SetBounds(imgOpponentPlayed(0).Left, VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentPlayed(0).Top) + 400 * i), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			If i > 3 Then
				imgOpponentPlayed(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentPlayed(0).Left) + 2000), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentPlayed(0).Top) + 400 * (i - 4)), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			End If
			imgOpponentPlayed(i).BringToFront()
			imgOpponentPlayed(i).Tag = -1
		Next i
		
		' initialize bought images
		For i = 0 To 40
			If i > imgOpponentBought.UBound Then
				imgOpponentBought.Load(i)
			End If
			imgOpponentBought(i).Visible = False
			imgOpponentBought(i).SetBounds(imgOpponentBought(0).Left, VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentBought(0).Top) + 400 * i), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			If i > 3 Then
				imgOpponentBought(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentBought(0).Left) + 2000), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentBought(0).Top) + 400 * (i - 4)), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			End If
			imgOpponentBought(i).BringToFront()
			imgOpponentBought(i).Tag = -1
		Next i
		
		win_streak = 0
		settings.Show()
		Me.Hide()
		' Call start_game
	End Sub
	
	Private Sub game_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
		End
	End Sub
	
	'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
	Private Sub append(ByVal str_Renamed As String)
		txtLog.Text = txtLog.Text & str_Renamed & Chr(13) & Chr(10)
		txtLog.SelectionStart = Len(txtLog.Text)
	End Sub
	
	'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
	Private Sub play_sound(ByVal str_Renamed As String)
		'MsgBox "Going to play " & str
		If (settings.chkSound.CheckState = 1 And phase = "action") Or (settings.chkInterface.CheckState = 1 And phase <> "action") Then
			Call PlaySound(My.Application.Info.DirectoryPath & "/sounds/" & str_Renamed, 0, &H0)
		End If
	End Sub
	
	Private Sub play_action(ByVal Index As Short)
		
		load_picture((Index))
		actions_played = actions_played + 1
		
		'MsgBox "Playing action: " & names(index) & " Phase= " & phase
		
		' if this was an attack, activate secret chamber for the active player
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object find_card(0, get_id_by_name(Secret Chamber)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If current_action = 0 And active_player > 0 And find_card(0, get_id_by_name("Secret Chamber")) > -1 And is_attack(Index) Then
			If phase = "action" Then
				Call draw_cards(0, 2)
				phase = "secret_chamber_react"
				Call show_prompt("Choose a card to put back with Chamber")
				'UPGRADE_WARNING: Couldn't resolve default property of object secret_chamber_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				secret_chamber_count = 2
				current_action = Index
				Exit Sub
			End If
		ElseIf phase = "secret_chamber_react" Then 
			current_action = 0
			phase = "action"
		End If
		
		' activate secret chamber for the other players
		Dim i, j As Object
		Dim card_index As Short
		For i = 1 To num_players - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object find_card(i, get_id_by_name(Secret Chamber)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If active_player <> i And is_attack(Index) And find_card(i, get_id_by_name("Secret Chamber")) > -1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call append(player_names(i) & " uses Secret Chamber")
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call draw_cards(i, 2)
				For j = 1 To 2
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_discard(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					card_index = find_best_card_to_discard(i)
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call put_on_top_of_deck(i, hand(i, card_index), 0)
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call remove_card_from_hand(i, card_index)
				Next j
			End If
		Next i
		
		' move the card from hand to limbo
		Dim copy_text As String
		If phase = "action" And can_play_action(active_player, Index) Then
			If throne_original_played = 1 And doing_golem = 0 Then
				copy_text = "copy of "
			End If
			Call append(player_names(active_player) & " plays " & copy_text & names(Index))
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If (throne_copies = 0 And throne_original_played = 0) Or doing_golem = 1 Then
				If active_player = 0 Then
					phase = "temp"
					Call play_sound("play_card.wav")
					phase = "action"
				End If
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call move_played_card(find_card(active_player, Index))
				'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_actions(active_player, actions - 1)
			End If
			'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			current_limbo_count = limbo_count(active_player)
			'    Call refresh_lists
		End If
		
		' do throne room maintenance
		If doing_golem = 0 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If phase = "action" And throne_copies > 0 And throne_original_played = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object throne_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				throne_card = get_id_by_name("Throne Room")
				'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf phase = "action" And throne_copies > 0 Then 
				throne_original_played = 1
			End If
		End If
		
		' play the action
		'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action(active_player, Index). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		Dim count As Short
		If can_play_action(active_player, Index) Then
			If is_duration(Index) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object duration_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				count = duration_count(active_player)
				durations_played(active_player, count) = Index
				durations_played(active_player, count + 1) = -1
			End If
			Call play_card_specific_action(Index)
			refresh_lists()
		End If
		
		' MsgBox "Done with action, actions remaining: " & actions & "throne copies = " & throne_copies & " original = " & throne_original_played
		
		' if the human is done playing actions, move to buy phase
		'If phase = "action" Then
		'MsgBox "At the end, phase = " & phase & " and golem = " & doing_golem
		If phase = "action" And doing_golem > 0 Then
			If active_player = 0 Then Call play_game()
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object can_play_actions(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf phase = "action" And active_player = 0 And can_play_actions(0) = 0 And settings.chkAutoEnd.CheckState = 1 And throne_copies = 0 Then 
			Call move_to_buy_phase(0)
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf throne_copies > 0 Then 
			Call play_game()
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf throne_copies = 0 And throne_original_played = 1 Then 
			'MsgBox "done throning"
			throne_original_played = 0
			Call play_game()
		End If
		'End If
		
		
	End Sub
	
	Private Function find_best_card_to_discard(ByVal i As Short) As Object
		' choose the worse card in hand in this order
		' 1) positive victory points
		' 2) curse
		' 3) cheapest card left
		Dim j As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For j = 0 To hand_count(i) - 1
			If hand(i, j) > 2 And hand(i, j) < 6 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_discard. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				find_best_card_to_discard = j
				Exit Function
			End If
		Next j
		'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_trash(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		find_best_card_to_discard = find_best_card_to_trash(i)
		
	End Function
	
	Private Function find_best_card_to_trash(ByVal i As Short) As Object
		' choose the worse card in hand in this order
		' 1) curse
		' 2) cheapest card left
		Dim j As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For j = 0 To hand_count(i) - 1
			If victory_points(hand(i, j)) = -1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_trash. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				find_best_card_to_trash = j
				Exit Function
			End If
		Next j
		
		Dim min_index, min_cost As Object
		'UPGRADE_WARNING: Couldn't resolve default property of object min_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		min_cost = 99
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For j = 0 To hand_count(i) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object min_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If costs(hand(i, j)) < min_cost Then
				'UPGRADE_WARNING: Couldn't resolve default property of object min_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				min_cost = costs(hand(i, j))
				'UPGRADE_WARNING: Couldn't resolve default property of object min_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				min_index = j
			End If
		Next j
		'UPGRADE_WARNING: Couldn't resolve default property of object min_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_trash. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		find_best_card_to_trash = min_index
	End Function
	
	
	Private Sub play_card_specific_action(ByVal Index As Short)
		
		Dim count, i, j, card_index As Object
		Dim opp As Short
		Dim card1, card2 As Object
		Dim choice As Short
		Dim cost, start_i, end_i, found As Object
		Dim temp_i As Short
		Dim intResponse As Short
		
		
		'MsgBox "here we go!"
		
		Dim keep_going As Short
		Dim victory_found As Object
		Dim discard_counter As Short
		Dim never(12) As Short
		Dim which As Short
		Dim chosen_card As Short
		Dim break As Short
		Dim coins_found As Short
		Dim chose_coin, chose_buy, chose_action, chose_card, yesses As Object
		Dim coin_found As Short
		Dim prev_player As Short
		Dim worst_card As Short
		Dim which_card As Short
		Dim human_steal As Object
		Dim trash_card As Short
		Dim trash, discard As Object
		Dim revealed As Short
		'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
		Dim str_Renamed As String
		'UPGRADE_NOTE: continue was upgraded to continue_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
		Dim continue_Renamed, action2, action1, swap, card As Object
		Dim intResult As Short
		Dim max As Object
		Dim max_index As Short
		If names(Index) = "Adventurer" Then
			keep_going = 2
			While keep_going > 0
				'UPGRADE_WARNING: Couldn't resolve default property of object draw_cards(active_player, 1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If draw_cards(active_player, 1) = 1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call append(names(Index) & " revealed " & names(hand(active_player, hand_count(active_player) - 1)))
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If gold(hand(active_player, hand_count(active_player) - 1)) > 0 Then
						keep_going = keep_going - 1
					Else
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call move_from_hand_to_limbo(active_player, hand_count(active_player) - 1)
					End If
				Else
					keep_going = 0
				End If
			End While
			
			Call move_limbo_cards_to_discard(active_player, current_limbo_count)
		ElseIf names(Index) = "Alchemist" Then 
			Call draw_cards(active_player, 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf names(Index) = "Ambassador" And hand_count(active_player) > 0 Then 
			If active_player = 0 Then
				phase = "ambassador"
				lblPrompt.Text = "Choose a card to share with everyone"
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call remove_card_from_hand(active_player, find_card(active_player, 6))
				pile_size(6) = pile_size(6) + 1
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, 6). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If find_card(active_player, 6) > -1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call remove_card_from_hand(0, find_card(active_player, 6))
					pile_size(6) = pile_size(6) + 1
					Call append(player_names(active_player) & " shares 2 Curses")
				Else
					Call append(player_names(active_player) & " shares a Curse")
				End If
				
				For i = active_player + 1 To active_player + num_players - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Mod has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
					opp = i Mod num_players
					'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If protected_Renamed(opp) = 0 Then
						Call gain_card(opp, 6)
					End If
				Next i
			End If
			
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf names(Index) = "Apprentice" And hand_count(active_player) > 0 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			If active_player = 0 Then
				phase = "apprentice"
				Call hide_next()
				lblPrompt.Text = "Choose a card to trash"
			Else
				' AI will not play this card
			End If
			
		ElseIf names(Index) = "Apothecary" Then 
			Call min_deck(active_player, 4)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			Call draw_cards(active_player, 1)
			For i = 3 To 0 Step -1
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i < deck_count(active_player) Then
					' put copper / potions cards in hand
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call append(player_names(active_player) & " reveals " & names(deck(active_player, i)))
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If names(deck(active_player, i)) = "Copper" Or names(deck(active_player, i)) = "Potion" Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call add_card_to_hand(active_player, deck(active_player, i))
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call remove_card_from_deck(active_player, i)
					ElseIf active_player = 0 Then 
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call add_choice(deck(0, i))
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call remove_card_from_deck(active_player, i)
						Call hide_next()
						Call hide_prompt()
						phase = "scout"
						lblPrompt2.Text = "Choose a card to put on top of your deck"
					End If
				End If
			Next i
			
		ElseIf names(Index) = "Baron" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			choice = 0
			'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, 3). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If find_card(active_player, 3) > -1 Then
				If active_player = 0 Then
					intResponse = MsgBox("Would you discard an Estate?", MsgBoxStyle.YesNo)
					If intResponse = MsgBoxResult.Yes Then
						choice = 1
					End If
				Else
					choice = 1
					Call append(player_names(active_player) & " discards an Estate")
				End If
			End If
			If choice = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call discard_card(active_player, find_card(active_player, 3))
				'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_coins(active_player, coins + 4)
			Else
				Call gain_card(active_player, 3)
			End If
			
		ElseIf names(Index) = "Bazaar" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 1)
			
		ElseIf names(Index) = "Bridge" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 1)
			bridges_played = bridges_played + 1
			For i = 0 To num_all_actions + 6
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If costs(i) > 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					costs(i) = costs(i) - 1
				End If
			Next i
			Call update_button_text()
			
		ElseIf names(Index) = "Bureaucrat" Then 
			Call play_sound("bureaucrat.wav")
			Call gain_card_to_deck(active_player, 1)
			For i = active_player + 1 To active_player + num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Mod has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
				opp = i Mod num_players
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(opp) = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object victory_found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					victory_found = 0
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					For j = 0 To hand_count(opp) - 1
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If victory_points(hand(opp, j)) > 0 Then
							If opp = 0 Then
								phase = "bureaucrat"
								Call show_prompt("Choose a victory card to discard to " & names(Index))
							Else
								'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call put_on_top_of_deck(opp, hand(opp, j), 1)
								'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call remove_card_from_hand(opp, j)
							End If
							'UPGRADE_WARNING: Couldn't resolve default property of object victory_found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							victory_found = 1
							Exit For
						End If
					Next j
					'UPGRADE_WARNING: Couldn't resolve default property of object victory_found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If victory_found = 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						For j = 0 To hand_count(opp) - 1
							'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call append(player_names(opp) & " reveals " & names(hand(opp, j)))
						Next j
					End If
				End If
			Next i
			
		ElseIf names(Index) = "Caravan" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			
		ElseIf names(Index) = "Cellar" Or names(Index) = "Secret Chamber" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If names(Index) = "Cellar" Then Call set_actions(active_player, actions + 1)
			If active_player = 0 Then
				phase = "cellar"
				If names(Index) <> "Cellar" Then phase = "secret_chamber"
				imgNext.Tag = 0
				Call show_next("Done Discarding")
				Call show_prompt("Choose a card to discard")
			Else
				' AI will discard any non-coins still left in hand
				discard_counter = 0
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				j = 0
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				While (j < hand_count(active_player))
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If gold(hand(active_player, j)) < 1 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call append(player_names(active_player) & " discards " & names(hand(active_player, j)))
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call discard_card(active_player, j)
						discard_counter = discard_counter + 1
					Else
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						j = j + 1
					End If
				End While
				If names(Index) = "Cellar" Then
					Call draw_cards(active_player, discard_counter)
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call set_coins(active_player, coins + discard_counter)
				End If
			End If
			
		ElseIf names(Index) = "Chapel" Then 
			If active_player = 0 Then
				phase = "chapel"
				Call show_next("Done Trashing")
				imgNext.Tag = 0
				lblPrompt.Text = "Choose a card to trash"
			Else
				' AI will trash only curses
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				j = 0
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				While (j < hand_count(active_player))
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If names(hand(active_player, j)) = "Curse" Then
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call trash_card_from_hand(active_player, j)
					Else
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						j = j + 1
					End If
				End While
			End If
			
		ElseIf names(Index) = "Chancellor" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			If active_player = 0 Then
				intResponse = MsgBox("Would you like to put your deck into your discard pile?", MsgBoxStyle.YesNo)
				If intResponse = MsgBoxResult.Yes Then
					put_deck_into_discard_pile((active_player))
				End If
			Else
				put_deck_into_discard_pile((active_player))
			End If
			
		ElseIf names(Index) = "Coppersmith" Then 
			coppersmith_played = coppersmith_played + 1
			
		ElseIf names(Index) = "Conspirator" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			If actions_played > 2 Then
				Call draw_cards(active_player, 1)
				'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_actions(active_player, actions + 1)
			End If
			
		ElseIf names(Index) = "Council Room" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			Call draw_cards(active_player, 3)
			For i = 0 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call draw_cards(i, 1)
			Next i
			
		ElseIf names(Index) = "Courtyard" Then 
			Call draw_cards(active_player, 3)
			If active_player = 0 Then
				Call hide_next()
				phase = "courtyard"
				Call show_prompt("Choose a card to put on top of deck " & names(Index))
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_discard(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object card_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				card_index = find_best_card_to_discard(active_player)
				'UPGRADE_WARNING: Couldn't resolve default property of object card_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call put_on_top_of_deck(active_player, hand(active_player, card_index), 0)
				'UPGRADE_WARNING: Couldn't resolve default property of object card_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call remove_card_from_hand(active_player, card_index)
			End If
			
		ElseIf names(Index) = "Cutpurse" Then 
			Call play_sound("thief.wav")
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			For i = 0 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i <> active_player Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If protected_Renamed(i) = 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object find_card(i, get_id_by_name(Copper)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If find_card(i, get_id_by_name("Copper")) > -1 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call append(player_names(i) & " discards Copper")
							'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call discard_card(i, find_card(i, get_id_by_name("Copper")))
						Else
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							For j = 0 To hand_count(i) - 1
								'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call append(player_names(i) & " reveals " & names(hand(i, j)))
							Next j
						End If
					End If
				End If
			Next i
			
		ElseIf names(Index) = "Envoy" Then 
			Call min_deck(active_player, 5)
			
			' if the person to your right plays this, you choose for them
			'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			count = 5
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If deck_count(active_player) < 5 Then count = deck_count(active_player)
			If active_player = num_players - 1 Then
				For j = 0 To imgOpponentPlayed.UBound
					If imgOpponentPlayed(j).Visible = True Then
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						imgWhite.Tag = j - 1
						imgOpponentBought(j).Tag = imgOpponentPlayed(j).Tag
					End If
				Next j
				Call hide_choices()
				
				lblPrompt2.Text = "Envoy: Choose a card for " & player_names(active_player) & " not to draw"
				'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For i = 0 To count - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					card1 = deck(active_player, i)
					'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call add_choice(card1)
					phase = "envoy"
				Next i
			Else
				' find the morst expensive non-VP in the deck
				'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				max = 0
				max_index = 0
				'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For i = 0 To count - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					card1 = deck(active_player, i)
					'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If victory_points(card1) = 0 And costs(card1) > max Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						max_index = i
						'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						max = costs(card1)
					End If
				Next i
				
				'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For i = 0 To count - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					card1 = deck(active_player, 0)
					Call draw_cards(active_player, 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If i = max_index Then
						'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call append(player_names(active_player) & " discards " & names(card1))
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call discard_card(active_player, hand_count(active_player) - 1)
					Else
						'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call append(player_names(active_player) & " reveals " & names(card1))
					End If
				Next i
			End If
			
			
		ElseIf names(Index) = "Embargo" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			If active_player = 0 Then
				phase = "embargo"
				lblPrompt.Text = "Choose a supply pile to Embargo"
				Call hide_next()
			Else
				' AI will embargo a pile at random that it will never buy
				'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				count = 0
				For i = 7 To 6 + num_actions
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If never_buy(id_by_pile(i)) Then
						'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						never(count) = id_by_pile(i)
						'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						count = count + 1
					End If
				Next i
				'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If count = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					which = get_id_by_name("Province")
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					which = never(Int(Rnd() * count))
				End If
				embargo(which) = embargo(which) + 1
				append((player_names(active_player) & " names " & names(which)))
			End If
			
		ElseIf names(Index) = "Explorer" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, get_id_by_name(Province)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If find_card(active_player, get_id_by_name("Province")) > -1 And pile_size(get_id_by_name("Gold")) > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card_to_hand(active_player, get_id_by_name("Gold"))
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card_to_hand(active_player, get_id_by_name("Silver"))
			End If
			
		ElseIf names(Index) = "Familiar" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			For i = active_player + 1 To active_player + num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Mod has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
				opp = i Mod num_players
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(opp) = 0 Then
					Call gain_card(opp, 6)
				End If
			Next i
			
		ElseIf names(Index) = "Feast" Then 
			If active_player = 0 Then
				phase = "feast"
				lblPrompt.Text = "Choose a card costing up to 5 to gain"
				Call hide_next()
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_for_cost(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card(active_player, find_best_card_for_cost(5, 0))
			End If
			
		ElseIf names(Index) = "Festival" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 2)
			
		ElseIf names(Index) = "Fishing Village" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 1)
			
		ElseIf names(Index) = "Golem" Then 
			' first find the 2 actions
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			count = hand_count(active_player)
			Call min_deck(active_player, 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object continue_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			continue_Renamed = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object continue_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			While continue_Renamed = 1
				'UPGRADE_WARNING: Couldn't resolve default property of object draw_cards(active_player, 1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If draw_cards(active_player, 1) = 1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					card = hand(active_player, hand_count(active_player) - 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call append(player_names(active_player) & " reveals " & names(card))
					'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If is_action(card) And names(card) <> "Golem" And names(card) <> "Throne Room" Then
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call remove_card_from_hand(active_player, hand_count(active_player) - 1)
						'UPGRADE_WARNING: Couldn't resolve default property of object action1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If action1 = 0 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object action1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							action1 = card
						Else
							'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object action2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							action2 = card
							'UPGRADE_WARNING: Couldn't resolve default property of object continue_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							continue_Renamed = 0
						End If
					End If
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object continue_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					continue_Renamed = 0 ' out of cards
				End If
			End While
			
			' discard any extra cards
			'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For i = hand_count(active_player) - 1 To count Step -1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call discard_card(active_player, i)
			Next i
			
			'UPGRADE_WARNING: Couldn't resolve default property of object action2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If active_player = 0 And action2 > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object action1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object action2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				intResult = MsgBox("You revealed " & names(action1) & " and " & names(action2) & ".  Would you like to play " & names(action1) & " first?", MsgBoxStyle.YesNo)
				If intResult = MsgBoxResult.No Then
					'UPGRADE_WARNING: Couldn't resolve default property of object action1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object swap. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					swap = action1
					'UPGRADE_WARNING: Couldn't resolve default property of object action2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object action1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					action1 = action2
					'UPGRADE_WARNING: Couldn't resolve default property of object swap. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object action2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					action2 = swap
				End If
			End If
			
			'UPGRADE_WARNING: Couldn't resolve default property of object action2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If action2 > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object action2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object golem_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				golem_card = action2
			End If
			
			' play action 1
			'UPGRADE_WARNING: Couldn't resolve default property of object action1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If action1 > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object action1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action(active_player, action1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If can_play_action(active_player, action1) Then actions = actions + 1
				'UPGRADE_WARNING: Couldn't resolve default property of object action1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call add_card_to_hand(active_player, action1)
				doing_golem = 1
				'UPGRADE_WARNING: Couldn't resolve default property of object action1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call play_action(action1)
				doing_golem = 0
			End If
			
		ElseIf names(Index) = "Ghost Ship" Then 
			If phase = "action" Then
				Call draw_cards(active_player, 2)
				Call play_sound("militia.wav")
			End If
			
			For i = 1 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i <> active_player Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If protected_Renamed(i) = 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						While hand_count(i) > 3
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_discard(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							card_index = find_best_card_to_discard(i)
							'UPGRADE_WARNING: Couldn't resolve default property of object card_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call put_on_top_of_deck(i, hand(i, card_index), 0)
							'UPGRADE_WARNING: Couldn't resolve default property of object card_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call remove_card_from_hand(i, card_index)
						End While
					End If
				End If
			Next i
			
			' make sure the human discards too
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If active_player <> 0 And hand_count(0) > 3 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(0) = 0 Then
					Call hide_next()
					phase = "ghost_ship"
					Call show_prompt("Ghost Ship: Choose a card to put on top of deck")
				End If
			End If
			
		ElseIf names(Index) = "Great Hall" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			
		ElseIf names(Index) = "Haven" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			If active_player = 0 Then
				phase = "haven"
				Call hide_next()
				lblPrompt.Text = "Choose a card to set aside"
			Else
				' if we have a lot of gold, try removing an action
				'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				max = -1
				max_index = 0
				chosen_card = -1
				If coins_available > 4 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					For i = 0 To hand_count(active_player) - 1
						'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If is_action(hand(active_player, i)) > 0 And costs(hand(active_player, i)) > max Then
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							max_index = i
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							max = costs(hand(active_player, i))
						End If
					Next i
					
					' if no action was found, remove a non-coin
					'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If max = -1 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						For i = 0 To hand_count(active_player) - 1
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If gold(hand(active_player, i)) = 0 Then
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								max_index = i
							End If
						Next i
					End If
				Else
					' we don't have a lot of gold, so choose our biggest coin
					'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					max = 0
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					For i = 0 To hand_count(active_player) - 1
						'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If gold(hand(active_player, i)) > max Then
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							max_index = i
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							max = gold(hand(active_player, i))
						End If
					Next i
				End If
				
				' if nothing was found, just pick any card
				'UPGRADE_WARNING: Couldn't resolve default property of object haven_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				haven(active_player, haven_count(active_player) + 1) = -1
				'UPGRADE_WARNING: Couldn't resolve default property of object haven_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				haven(active_player, haven_count(active_player)) = hand(active_player, max_index)
				Call remove_card_from_hand(active_player, 0)
			End If
		ElseIf names(Index) = "Herbalist" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 1)
		ElseIf names(Index) = "Ironworks" Then 
			If active_player = 0 Then
				phase = "ironworks"
				lblPrompt.Text = "Choose a card costing up to 4 to gain"
				Call hide_next()
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_for_cost(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				card1 = find_best_card_for_cost(4, 0)
				'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card(active_player, card1)
				'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If is_action(card1) Then Call set_actions(active_player, actions + 1)
				'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If gold(card1) > 0 Then Call set_coins(active_player, coins + 1)
				'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If victory_points(card1) > 0 Then Call draw_cards(active_player, 1)
			End If
			
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf names(Index) = "Island" And hand_count(active_player) > 0 Then 
			If active_player = 0 Then
				phase = "island"
				Call hide_next()
				lblPrompt.Text = "Choose a card to set aside"
			Else
				For i = 3 To 6
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					card1 = find_card(active_player, i)
					'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If card1 > -1 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						card2 = hand(active_player, card1)
						'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call append(player_names(active_player) & " sets aside " & names(card2))
						'UPGRADE_WARNING: Couldn't resolve default property of object island_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						island(active_player, island_count(active_player) + 1) = -1
						'UPGRADE_WARNING: Couldn't resolve default property of object island_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						island(active_player, island_count(active_player)) = card2
						'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call remove_card_from_hand(active_player, card1)
						Exit Sub
					End If
				Next 
			End If
			
		ElseIf names(Index) = "Laboratory" Then 
			Call draw_cards(active_player, 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			
		ElseIf names(Index) = "Library" Then 
			break = 0
			intResult = MsgBoxResult.Yes
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			While hand_count(active_player) < 7 And break = 0
				'UPGRADE_WARNING: Couldn't resolve default property of object draw_cards(active_player, 1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If draw_cards(active_player, 1) = 1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call append(names(Index) & " draws " & names(hand(active_player, hand_count(active_player) - 1)))
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If is_action(hand(active_player, hand_count(active_player) - 1)) > 0 Then
						If active_player = 0 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							intResult = MsgBox("Would you like to set aside " & names(hand(active_player, hand_count(active_player) - 1)) & "?", MsgBoxStyle.YesNo)
						End If
						If intResult = MsgBoxResult.Yes Then
							'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call append(player_names(active_player) & " sets aside " & names(hand(active_player, hand_count(active_player) - 1)))
							'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call move_from_hand_to_limbo(active_player, hand_count(active_player) - 1)
						End If
					End If
				Else
					break = 1
				End If
			End While
			
			Call move_limbo_cards_to_discard(active_player, current_limbo_count)
			
		ElseIf names(Index) = "Lighthouse" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 1)
			
		ElseIf names(Index) = "Lookout" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			Call min_deck(active_player, 3)
			
			If active_player = 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If deck_count(0) = 0 Then Exit Sub
				Call hide_next()
				Call hide_prompt()
				phase = "lookout"
				lblPrompt2.Text = "Choose a card to trash"
				
				revealed = 3
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If deck_count(0) < 3 Then revealed = deck_count(0)
				For i = 0 To revealed - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call add_choice(deck(0, i))
				Next i
				Call draw_cards(0, revealed)
				For i = 1 To revealed
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call remove_card_from_hand(0, hand_count(0) - 1)
				Next i
			End If
			
		ElseIf names(Index) = "Outpost" Then 
			going_to_take_extra_turn = 1
			
		ElseIf names(Index) = "Market" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			
		ElseIf names(Index) = "Masquerade" Then 
			Call draw_cards(active_player, 2)
			phase = "masquerade"
			Call show_prompt("Choose a card to pass")
			Call hide_next()
			
		ElseIf names(Index) = "Merchant Ship" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			
		ElseIf names(Index) = "Militia" Then 
			If phase = "action" Then
				'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_coins(active_player, coins + 2)
				Call play_sound("militia.wav")
			End If
			
			For i = 1 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i <> active_player Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If protected_Renamed(i) = 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						While hand_count(i) > 3
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call discard_worst_card(i)
						End While
					End If
				End If
			Next i
			
			' make sure the human discards too
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If active_player <> 0 And hand_count(0) > 3 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(0) = 0 Then
					phase = "militia"
					Call show_prompt("Choose a card to discard to " & names(Index))
				End If
			End If
			
		ElseIf names(Index) = "Mine" Then 
			coins_found = 0
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For i = 0 To hand_count(active_player) - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If gold(hand(active_player, i)) > 0 Then
					coins_found = 1
				End If
			Next i
			If coins_found = 0 Then
				Exit Sub
			End If
			
			If active_player = 0 Then
				phase = "mine"
				Call hide_next()
				lblPrompt.Text = "Choose a coin card to trash"
			Else
				' AI will trash only coppers and silvers (silver first)
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, 1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If find_card(active_player, 1) > -1 And pile_size(2) > 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call trash_card_from_hand(active_player, find_card(active_player, 1))
					Call gain_card_to_hand(active_player, 2)
					'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, 0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				ElseIf find_card(active_player, 0) > -1 And pile_size(1) > 0 Then 
					'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call trash_card_from_hand(active_player, find_card(active_player, 0))
					Call gain_card_to_hand(active_player, 1)
				End If
			End If
			
		ElseIf names(Index) = "Mining Village" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 2)
			intResponse = MsgBoxResult.No
			If active_player = 0 Then
				intResponse = MsgBox("Would you like trash Mining Village to gain 2 coins?", MsgBoxStyle.YesNo)
			ElseIf coins_available > 3 And coins_available < 8 Then 
				intResponse = MsgBoxResult.Yes
			End If
			If intResponse = MsgBoxResult.Yes Then
				'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_coins(active_player, coins + 2)
				Call append(player_names(active_player) & " trashes Mining Village")
				'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				limbo(active_player, limbo_count(active_player) - 1) = -1
			End If
			
		ElseIf names(Index) = "Minion" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			intResponse = MsgBoxResult.No
			If active_player = 0 Then
				intResponse = MsgBox("Would you like gain 2 coins?", MsgBoxStyle.YesNo)
			ElseIf coins_available > 3 And coins_available < 8 Then 
				intResponse = MsgBoxResult.Yes
			End If
			If intResponse = MsgBoxResult.Yes Then
				'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_coins(active_player, coins + 2)
				Call append(player_names(active_player) & " gets 2 coins")
			Else
				Call append(player_names(active_player) & " draws a new hand")
				For i = 0 To num_players - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If protected_Renamed(i) = 0 And (hand_count(i) > 4 Or active_player = i) Then
						'put hand into discard
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						For j = 0 To hand_count(i) - 1
							'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call add_card_to_discard(i, hand(i, j))
						Next j
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						hand(i, 0) = -1
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call draw_cards(i, 4)
					End If
				Next i
			End If
			
		ElseIf names(Index) = "Moat" Then 
			Call draw_cards(active_player, 2)
			
		ElseIf names(Index) = "Moneylender" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, 0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If find_card(active_player, 0) > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call trash_card_from_hand(active_player, find_card(active_player, 0))
				'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_coins(active_player, coins + 3)
			End If
			
		ElseIf names(Index) = "Native Village" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 2)
			intResponse = MsgBoxResult.Yes
			If active_player = 0 Then
				intResponse = MsgBox("Would you like to hide a card under Native Village?", MsgBoxStyle.YesNo)
				'UPGRADE_WARNING: Couldn't resolve default property of object village_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf village_count(active_player) > 1 Then 
				intResponse = MsgBoxResult.No
			End If
			If intResponse = MsgBoxResult.Yes Then
				append(player_names(active_player) & " hides a card")
				'UPGRADE_WARNING: Couldn't resolve default property of object draw_cards(active_player, 1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If draw_cards(active_player, 1) = 1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object village_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					count = village_count(active_player)
					'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					native_village(active_player, count) = hand(active_player, hand_count(active_player) - 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					native_village(active_player, count + 1) = -1
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call remove_card_from_hand(active_player, hand_count(active_player) - 1)
					If active_player = 0 Then
						lblVillageCards.Text = ""
						'UPGRADE_WARNING: Couldn't resolve default property of object village_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						For i = 0 To village_count(active_player) - 1
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							lblVillageCards.Text = lblVillageCards.Text & names(native_village(active_player, i)) & " "
						Next i
					End If
				End If
			Else
				append(player_names(active_player) & " draws cards")
				'UPGRADE_WARNING: Couldn't resolve default property of object village_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For i = 0 To village_count(active_player) - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call add_card_to_hand(active_player, native_village(active_player, i))
				Next i
				native_village(active_player, 0) = -1
				If active_player = 0 Then
					lblVillageCards.Text = "None"
				End If
			End If
			
		ElseIf names(Index) = "Navigator" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			If active_player = 0 Then
				Call min_deck(0, 5)
				revealed = 5
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If deck_count(0) < 5 Then revealed = deck_count(0)
				lblPrompt2.Text = "Revealed Cards"
				For i = 0 To revealed - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call add_choice(deck(0, i))
				Next i
				intResponse = MsgBox("Would you like to discard all of these cards?", MsgBoxStyle.YesNo)
				Call draw_cards(0, revealed)
				If intResponse = MsgBoxResult.Yes Then
					Call hide_choices()
					For i = 1 To revealed
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call discard_card(0, hand_count(0) - 1)
					Next i
				Else
					Call hide_next()
					Call hide_prompt()
					phase = "navigator"
					lblPrompt2.Text = "Choose a card to put on top of your deck"
					For i = 1 To revealed
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call remove_card_from_hand(0, hand_count(0) - 1)
					Next i
				End If
				
			End If
			
		ElseIf names(Index) = "Nobles" Then 
			If active_player = 0 Then
				intResponse = MsgBox("Would you like to draw 3 cards?", MsgBoxStyle.YesNo)
			Else
				intResponse = MsgBoxResult.Yes
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For i = 0 To hand_count(active_player) - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If is_action(hand(active_player, i)) Then found = found + 1
				Next i
				'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If found > 1 Then
					intResponse = MsgBoxResult.No
					Call append(player_names(active_player) & " adds 2 actions")
				Else
					Call append(player_names(active_player) & " draws 3 cards")
				End If
			End If
			If intResponse = MsgBoxResult.Yes Then
				Call draw_cards(active_player, 3)
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_actions(active_player, actions + 2)
			End If
			
			
		ElseIf names(Index) = "Pawn" Then 
			If active_player = 0 Then
				intResponse = MsgBox("Add an action?", MsgBoxStyle.YesNo)
				If intResponse = MsgBoxResult.Yes Then
					'UPGRADE_WARNING: Couldn't resolve default property of object chose_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					chose_action = 1
					'UPGRADE_WARNING: Couldn't resolve default property of object yesses. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					yesses = yesses + 1
				End If
				intResponse = MsgBox("Draw a card?", MsgBoxStyle.YesNo)
				If intResponse = MsgBoxResult.Yes Then
					'UPGRADE_WARNING: Couldn't resolve default property of object chose_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					chose_card = 1
					'UPGRADE_WARNING: Couldn't resolve default property of object yesses. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					yesses = yesses + 1
				End If
				'UPGRADE_WARNING: Couldn't resolve default property of object yesses. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If yesses = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object chose_buy. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					chose_buy = 1
					'UPGRADE_WARNING: Couldn't resolve default property of object chose_coin. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					chose_coin = 1
					'UPGRADE_WARNING: Couldn't resolve default property of object yesses. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				ElseIf yesses = 1 Then 
					intResponse = MsgBox("Add a coin?", MsgBoxStyle.YesNo)
					If intResponse = MsgBoxResult.Yes Then
						'UPGRADE_WARNING: Couldn't resolve default property of object chose_coin. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						chose_coin = 1
					Else
						'UPGRADE_WARNING: Couldn't resolve default property of object chose_buy. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						chose_buy = 1
					End If
				End If
				
			Else
				Call append(player_names(active_player) & " adds 1 coin")
				'UPGRADE_WARNING: Couldn't resolve default property of object chose_coin. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				chose_coin = 1
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For i = 0 To hand_count(active_player) - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If is_action(hand(active_player, i)) Then
						'UPGRADE_WARNING: Couldn't resolve default property of object chose_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						chose_action = 1
						Call append(player_names(active_player) & " adds an action")
					End If
				Next i
				'UPGRADE_WARNING: Couldn't resolve default property of object chose_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If chose_action = 0 Then
					Call append(player_names(active_player) & " draws a card")
					'UPGRADE_WARNING: Couldn't resolve default property of object chose_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					chose_card = 1
				End If
			End If
			
			'UPGRADE_WARNING: Couldn't resolve default property of object chose_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If chose_action = 1 Then Call set_actions(active_player, actions + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object chose_coin. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If chose_coin = 1 Then Call set_coins(active_player, coins + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object chose_buy. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If chose_buy = 1 Then Call set_buys(active_player, buys + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object chose_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If chose_card = 1 Then Call draw_cards(active_player, 1)
			
		ElseIf names(Index) = "Pearl Diver" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			Call draw_cards(active_player, 1)
			Call min_deck(active_player, 1)
			
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			count = deck_count(active_player)
			'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If count = 0 Then Exit Sub
			intResponse = MsgBoxResult.No
			If active_player = 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				intResponse = MsgBox("Would you like to put " & names(deck(active_player, count - 1)) & " on top of your deck?", MsgBoxStyle.YesNo)
				'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf victory_points(deck(active_player, count - 1)) = 0 Then 
				intResponse = MsgBoxResult.Yes
			End If
			If intResponse = MsgBoxResult.Yes Then
				'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call put_on_top_of_deck(active_player, deck(active_player, count - 1), 0)
				'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				deck(active_player, count) = -1
			End If
			
		ElseIf names(Index) = "Pirate Ship" Then 
			Call play_sound("thief.wav")
			
			intResult = MsgBoxResult.Yes
			If active_player = 0 Then
				intResult = MsgBox(str_Renamed & Chr(13) & "Would you like use Pirate Ship to steal coins?", MsgBoxStyle.YesNo)
				'UPGRADE_WARNING: Couldn't resolve default property of object coin_tokens(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf coin_tokens(active_player) > 3 Then 
				intResult = MsgBoxResult.No
			End If
			If intResult = MsgBoxResult.No Then
				'UPGRADE_WARNING: Couldn't resolve default property of object coin_tokens(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_coins(active_player, coins + coin_tokens(active_player))
				For i = 0 To num_players - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call protected_Renamed(i) ' trigger secret chamber
				Next i
				Exit Sub
			End If
			
			
			coin_found = 0
			For i = 0 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i <> active_player Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If protected_Renamed(i) = 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call min_deck(i, 2)
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If deck_count(i) = 1 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call append(player_names(i) & " reveals " & names(deck(i, 0)))
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If gold(deck(i, 0)) > 0 Then
								coin_found = 1
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								deck(i, 0) = -1
							Else
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call add_card_to_discard(i, deck(i, 0))
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								deck(i, 0) = -1
							End If
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						ElseIf deck_count(i) > 0 Then 
							
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call draw_cards(i, 2)
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							count = hand_count(i)
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							card1 = hand(i, count - 1)
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							card2 = hand(i, count - 2)
							'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							str_Renamed = player_names(i) & " reveals " & names(card1) & " and " & names(card2)
							Call append(str_Renamed)
							intResult = MsgBoxResult.Yes
							choice = 1
							'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If active_player = 0 And gold(card1) > 0 And gold(card2) > 0 And card1 <> card2 Then
								'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								intResult = MsgBox(str_Renamed & Chr(13) & "Would you like to trash the " & names(card1) & "?", MsgBoxStyle.YesNo)
								If intResult = MsgBoxResult.Yes Then choice = 0
								'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							ElseIf (gold(card1) > 0 And gold(card2) > 0 And card1 > card2) Or (gold(card1) > 0 And gold(card2) = 0) Then 
								choice = 0
								'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							ElseIf gold(card1) = 0 And gold(card2) = 0 Then 
								choice = 2
							End If
							
							If choice = 0 Then
								coin_found = 1
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call discard_card(i, count - 2)
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call remove_card_from_hand(i, count - 2)
							ElseIf choice = 1 Then 
								coin_found = 1
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call discard_card(i, count - 1)
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call remove_card_from_hand(i, count - 2)
							Else
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call discard_card(i, count - 1)
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call discard_card(i, count - 2)
							End If
							
						End If
					End If
				End If
			Next i
			
			If coin_found = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object coin_tokens(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object coin_tokens(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				coin_tokens(active_player) = coin_tokens(active_player) + 1
				'UPGRADE_WARNING: Couldn't resolve default property of object coin_tokens(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				lblCoinTokens.Text = coin_tokens(0)
			End If
			
		ElseIf names(Index) = "Possession" Then 
			possessed = 1
			player_names(1) = "Possessed " & player_names(1)
			
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf names(Index) = "Remodel" And hand_count(active_player) > 0 Then 
			If active_player = 0 Then
				phase = "remodel"
				Call hide_next()
				lblPrompt.Text = "Choose a card to trash"
			Else
				' AI will not play this card
			End If
			
		ElseIf names(Index) = "Saboteur" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object start_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			start_i = active_player + 1
			'UPGRADE_WARNING: Couldn't resolve default property of object end_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			end_i = num_players - 1
			If active_player <> 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object end_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				end_i = num_players
			End If
			If phase = "saboteur" Then
				phase = "action"
				'UPGRADE_WARNING: Couldn't resolve default property of object start_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				start_i = 1
				'UPGRADE_WARNING: Couldn't resolve default property of object end_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				end_i = active_player - 1
			End If
			
			'UPGRADE_WARNING: Couldn't resolve default property of object end_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object start_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For temp_i = start_i To end_i
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				i = temp_i
				If temp_i = num_players Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					i = 0
				End If
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				current_limbo_count = limbo_count(i)
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(i) = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					j = 0
					'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					found = 0
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call min_deck(i, 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					While (deck_count(i) > 0 And found = 0)
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If costs(deck(i, 0)) < 3 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call append(player_names(i) & " reveals " & names(deck(i, 0)))
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call add_card_to_limbo(i, deck(i, 0))
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call remove_card_from_deck(i, 0)
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call min_deck(i, 1)
						Else
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call append(player_names(i) & " trashes " & names(deck(i, 0)))
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							cost = costs(deck(i, 0))
							'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							remodel_cost = cost - 2
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							remodel_potions = potions(deck(i, 0))
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call remove_card_from_deck(i, 0)
							'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							found = 1
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If i = 0 Then
								phase = "saboteur"
								'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call show_prompt("Saboteur: Choose a card costing up to " & cost - 2 & " to gain")
								Call show_next("Gain nothing")
								For j = 0 To imgOpponentPlayed.UBound
									'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									If imgOpponentPlayed(j).Visible = True Then imgWhite.Tag = j - 1
								Next j
								Call hide_choices()
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call move_limbo_cards_to_discard(i, current_limbo_count)
								Exit Sub
							Else
								'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_for_cost(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call gain_card(i, find_best_card_for_cost(cost - 2, 0))
							End If
						End If
						
					End While
				End If
				
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call move_limbo_cards_to_discard(i, current_limbo_count)
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i = 0 Then
					phase = "saboteur"
					Call play_card_specific_action(Index)
					Call play_game()
				End If
				Call refresh_lists()
			Next temp_i
			
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf names(Index) = "Salvager" And hand_count(active_player) > 0 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			If active_player = 0 Then
				phase = "salvager"
				Call hide_next()
				lblPrompt.Text = "Choose a card to trash"
			Else
				' AI will not play this card
			End If
			
		ElseIf names(Index) = "Scout" Then 
			Call min_deck(active_player, 4)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			For i = 3 To 0 Step -1
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i < deck_count(active_player) Then
					' put victory cards in hand
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call append(player_names(active_player) & " reveals " & names(deck(active_player, i)))
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If victory_points(deck(active_player, i)) > 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call add_card_to_hand(active_player, deck(active_player, i))
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call remove_card_from_deck(active_player, i)
					ElseIf active_player = 0 Then 
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call add_choice(deck(0, i))
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call remove_card_from_deck(active_player, i)
						Call hide_next()
						Call hide_prompt()
						phase = "scout"
						lblPrompt2.Text = "Choose a card to put on top of your deck"
					End If
				End If
			Next i
			
		ElseIf names(Index) = "Scrying Pool" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			For i = 0 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i = active_player Or protected_Renamed(i) = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call min_deck(i, 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If deck_count(i) > 0 Then
						' for the AI, leave estates and copper only
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call draw_cards(i, 1)
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						count = hand_count(i)
						'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						card = hand(i, count - 1)
						'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call append(player_names(i) & " reveals " & names(card))
						If active_player <> 0 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If victory_points(card) = 0 And names(card) <> "Copper" Then
								intResponse = MsgBoxResult.Yes
							Else
								intResponse = MsgBoxResult.No
							End If
						Else
							'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							intResponse = MsgBox("Discard " & player_names(i) & "'s " & names(card) & "?", MsgBoxStyle.YesNo)
						End If
						If intResponse = MsgBoxResult.Yes Then
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call discard_card(i, count - 1)
							append(("It is discarded"))
						Else
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call remove_card_from_hand(i, count - 1)
							'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call put_on_top_of_deck(i, card, 1)
						End If
					End If
				End If
			Next i
			
			' now draw cards until we hit a non-action
			'UPGRADE_WARNING: Couldn't resolve default property of object draw_cards(active_player, 1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			While draw_cards(active_player, 1) > 0
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				card = hand(active_player, hand_count(active_player) - 1)
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call append(player_names(active_player) & " reveals " & names(card))
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If is_action(card) = 0 Then Exit Sub
			End While
			
		ElseIf names(Index) = "Sea Hag" Then 
			Call play_sound("witch.wav")
			For i = active_player + 1 To active_player + num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Mod has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
				opp = i Mod num_players
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(opp) = 0 Then
					Call min_deck(opp, 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If deck_count(opp) > 0 Then
						Call draw_cards(opp, 1)
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call append(player_names(opp) & " discards " & names(hand(opp, hand_count(opp) - 1)))
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call discard_card(opp, hand_count(opp) - 1)
					End If
					Call gain_card_to_deck(opp, 6)
				End If
			Next i
			
		ElseIf names(Index) = "Shanty Town" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For i = 0 To hand_count(active_player) - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If is_action(hand(active_player, i)) Then
					Exit Sub
				End If
			Next i
			Call draw_cards(active_player, 2)
			
		ElseIf names(Index) = "Smithy" Then 
			Call draw_cards(active_player, 3)
			
		ElseIf names(Index) = "Smugglers" Then 
			' MsgBox "About to get "
			' MsgBox get_best_card_prev_gained()
			prev_player = (active_player + num_players - 1) Mod num_players
			If active_player = 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_best_card_prev_gained(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If get_best_card_prev_gained() > -1 Then
					phase = "smugglers"
					lblPrompt2.Text = "Choose a card costing 6 or less to gain"
					Call hide_next()
					Call hide_prompt()
					'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(prev_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					For i = 0 To gained_count(prev_player) - 1
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call add_choice(gained(prev_player, i))
					Next i
				End If
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object get_best_card_prev_gained(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card(active_player, get_best_card_prev_gained())
			End If
			
		ElseIf names(Index) = "Spy" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			For i = 0 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i = active_player Or protected_Renamed(i) = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call min_deck(i, 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If deck_count(i) > 0 Then
						' for the AI, leave estates and copper only
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call draw_cards(i, 1)
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						count = hand_count(i)
						'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						card = hand(i, count - 1)
						'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call append(player_names(i) & " reveals " & names(card))
						If active_player <> 0 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If victory_points(card) = 0 And names(card) <> "Copper" Then
								intResponse = MsgBoxResult.Yes
							Else
								intResponse = MsgBoxResult.No
							End If
						Else
							'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							intResponse = MsgBox("Discard " & player_names(i) & "'s " & names(card) & "?", MsgBoxStyle.YesNo)
						End If
						If intResponse = MsgBoxResult.Yes Then
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call discard_card(i, count - 1)
							append(("It is discarded"))
						Else
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call remove_card_from_hand(i, count - 1)
							'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call put_on_top_of_deck(i, card, 1)
						End If
					End If
				End If
			Next i
			
		ElseIf names(Index) = "Steward" Then 
			If active_player = 0 Then
				intResponse = MsgBox("Would you like to draw 2 cards?", MsgBoxStyle.YesNo)
				If intResponse = MsgBoxResult.Yes Then
					choice = 0
				Else
					intResponse = MsgBox("Would you like to add 2 coins?", MsgBoxStyle.YesNo)
					If intResponse = MsgBoxResult.Yes Then
						choice = 1
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					ElseIf hand_count(0) > 0 Then 
						phase = "steward"
						lblPrompt.Tag = 0
						Call show_prompt("Choose a card to trash")
						Call hide_next()
						choice = 2
					Else
						Exit Sub
					End If
				End If
			Else
				If coins_available >= 3 Then
					choice = 1
					Call append(player_names(active_player) & " adds 2 coins")
				Else
					choice = 0
					Call append(player_names(active_player) & " draws 2 cards")
				End If
			End If
			
			If choice = 0 Then
				Call draw_cards(active_player, 2)
			ElseIf choice = 1 Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_coins(active_player, coins + 2)
			End If
			
		ElseIf names(Index) = "Swindler" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			If active_player = 0 Then
				For i = 1 To num_players - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If protected_Renamed(i) = 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call draw_cards(i, 1)
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						cost = costs(hand(i, hand_count(i) - 1))
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						remodel_potions = potions(hand(i, hand_count(i) - 1))
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call trash_card_from_hand(i, hand_count(i) - 1)
						'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object find_worst_card_for_cost(cost, remodel_potions). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If find_worst_card_for_cost(cost, remodel_potions) > -1 Then
							phase = "swindler"
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							lblPrompt.Tag = i
							'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							lblPrompt2.Tag = cost
							'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call show_prompt("Choose a card to give " & player_names(i) & " that costs " & cost)
							If remodel_potions > 0 Then
								lblPrompt.Text = lblPrompt.Text & "+P"
							End If
							Call hide_next()
							Exit Sub
						End If
					End If
				Next i
			End If
			
			For i = active_player + 1 To active_player + num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Mod has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
				opp = i Mod num_players
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(opp) = 0 Then
					Call draw_cards(opp, 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					cost = costs(hand(opp, hand_count(opp) - 1))
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					remodel_potions = potions(hand(opp, hand_count(opp) - 1))
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call trash_card_from_hand(opp, hand_count(opp) - 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object find_worst_card_for_cost(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					worst_card = find_worst_card_for_cost(cost, remodel_potions)
					If worst_card > -1 Then
						Call gain_card(opp, worst_card)
					End If
				End If
			Next i
			
		ElseIf names(Index) = "Tactician" Then 
			' if there are no cards left in hand then this action doesn't do anything
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If hand_count(active_player) = 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object duration_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				durations_played(active_player, duration_count(active_player) - 1) = -1
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				While hand_count(active_player) > 0
					Call append(player_names(active_player) & " discards " & names(hand(active_player, 0)))
					Call discard_card(active_player, 0)
				End While
			End If
			
		ElseIf names(Index) = "Thief" Then 
			Call play_sound("thief.wav")
			For i = 0 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i <> active_player Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If protected_Renamed(i) = 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call min_deck(i, 2)
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If deck_count(i) = 1 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call draw_cards(i, 1)
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							count = hand_count(i)
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call append(player_names(i) & " reveals " & names(card1))
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							card1 = hand(i, count - 1)
							intResult = MsgBoxResult.No
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If gold(card1) > 0 Then
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call remove_card_from_hand(i, count - 1)
								intResult = MsgBoxResult.Yes
								If active_player = 0 Then
									'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									intResult = MsgBox("Would you like to take " & player_names(i) & "'s " & names(card1) & "?", MsgBoxStyle.YesNo)
								End If
							End If
							If intResult = MsgBoxResult.Yes Then
								'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call add_card_to_discard(active_player, card1)
								'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								gained(active_player, gained_count(active_player) + 1) = -1
								'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								gained(active_player, gained_count(active_player)) = card1
								If active_player > 0 Then
									'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									Call add_ai_play(card1, 1)
								End If
							End If
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						ElseIf deck_count(i) > 0 Then 
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call draw_cards(i, 2)
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							count = hand_count(i)
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							card1 = hand(i, count - 1)
							'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							card2 = hand(i, count - 2)
							'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							str_Renamed = player_names(i) & " reveals " & names(card1) & " and " & names(card2)
							Call append(str_Renamed)
							intResult = MsgBoxResult.Yes
							
							' if both cards are treasure, let the HUMAN choose which to steal, if any
							'UPGRADE_WARNING: Couldn't resolve default property of object human_steal. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							human_steal = -1
							trash_card = -1
							'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If active_player = 0 And (gold(card1) > 0 Or gold(card2) > 0) Then
								' if both cards are treasure, decide which to trash
								'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								If card1 = card2 Or gold(card2) = 0 Then
									trash_card = 1
									'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								ElseIf gold(card1) > 0 And gold(card2) > 0 Then 
									'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									intResult = MsgBox(str_Renamed & Chr(13) & "Would you like to trash " & player_names(i) & "'s " & names(card1) & "?", MsgBoxStyle.YesNo)
									If intResult = MsgBoxResult.Yes Then
										trash_card = 1
									Else
										trash_card = 2
									End If
								Else
									trash_card = 2
								End If
								
								' Decide if we should steal the trashed card
								If trash_card = 1 Then
									'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									intResult = MsgBox(str_Renamed & Chr(13) & "Would you like to take " & player_names(i) & "'s " & names(card1) & "?", MsgBoxStyle.YesNo)
								ElseIf trash_card = 2 Then 
									'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									intResult = MsgBox(str_Renamed & Chr(13) & "Would you like to take " & player_names(i) & "'s " & names(card2) & "?", MsgBoxStyle.YesNo)
								End If
								If intResult = MsgBoxResult.Yes Then
									'UPGRADE_WARNING: Couldn't resolve default property of object human_steal. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									human_steal = 1
								End If
							End If
							
							'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If trash_card = 1 Or (active_player > 0 And gold(card1) > 0 And gold(card2) > 0 And card1 > card2) Or (active_player > 0 And gold(card1) > 0 And gold(card2) = 0) Then
								'UPGRADE_WARNING: Couldn't resolve default property of object human_steal. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								If active_player > 0 Or human_steal = 1 Then
									'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									Call add_card_to_discard(active_player, card1)
									'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									gained(active_player, gained_count(active_player) + 1) = -1
									'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									gained(active_player, gained_count(active_player)) = card1
								End If
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call remove_card_from_hand(i, count - 1)
								If active_player > 0 Then
									'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									Call add_ai_play(card1, 1)
								End If
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call discard_card(i, count - 2)
								'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object human_steal. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							ElseIf human_steal = 1 Or (active_player > 0 And gold(card2) > 0) Then 
								'UPGRADE_WARNING: Couldn't resolve default property of object human_steal. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								If active_player > 0 Or human_steal = 1 Then
									'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									Call add_card_to_discard(active_player, card2)
									'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									gained(active_player, gained_count(active_player) + 1) = -1
									'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									gained(active_player, gained_count(active_player)) = card2
								End If
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call discard_card(i, count - 1)
								If active_player > 0 Then
									'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
									Call add_ai_play(card2, 1)
								End If
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call remove_card_from_hand(i, count - 2)
							Else
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call discard_card(i, count - 1)
								'UPGRADE_WARNING: Couldn't resolve default property of object count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call discard_card(i, count - 2)
							End If
						End If
					End If
				End If
			Next i
			
		ElseIf names(Index) = "Throne Room" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			If active_player <> 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_action_to_play(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object throne_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				throne_card = find_best_action_to_play()
				'UPGRADE_WARNING: Couldn't resolve default property of object throne_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If throne_card > -1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					throne_copies = throne_copies + 1
					throne_original_played = 0
					'UPGRADE_WARNING: Couldn't resolve default property of object throne_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call add_ai_play(throne_card, 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object throne_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call move_played_card(find_card(active_player, throne_card))
					Call play_game() ' the copy will get played here
					Exit Sub
				End If
			Else
				phase = "throne_room"
				lblPrompt.Text = "Choose an action to copy"
				Call hide_next()
			End If
			
		ElseIf names(Index) = "Torturer" Then 
			If phase = "action" Then Call draw_cards(active_player, 3)
			
			'UPGRADE_WARNING: Couldn't resolve default property of object start_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			start_i = active_player + 1
			'UPGRADE_WARNING: Couldn't resolve default property of object end_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			end_i = num_players - 1
			If active_player <> 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object end_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				end_i = num_players
			End If
			If phase = "torturer" Then
				phase = "action"
				'UPGRADE_WARNING: Couldn't resolve default property of object start_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				start_i = 1
				'UPGRADE_WARNING: Couldn't resolve default property of object end_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				end_i = active_player - 1
			End If
			
			'UPGRADE_WARNING: Couldn't resolve default property of object end_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object start_i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For temp_i = start_i To end_i
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				i = temp_i
				If temp_i = num_players Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					i = 0
				End If
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(i) = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If i = 0 Then
						intResult = MsgBox("Would you like to gain a curse to hand?", MsgBoxStyle.YesNo)
						phase = "torturer"
						If intResult = MsgBoxResult.Yes Then
							'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call gain_card_to_hand(i, get_id_by_name("Curse"))
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						ElseIf hand_count(i) > 0 Then 
							Call show_prompt("Choose a card to discard to Torturer")
							lblPrompt.Tag = 0
							Exit Sub
						End If
						Call play_card_specific_action(Index)
						Call play_game()
					Else
						' take a curse if there are none left
						choice = -1
						If pile_size(6) = 0 Then
							choice = 1
						End If
						
						' discard if we have 2 VP's or coppers
						'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						found = 0
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						For j = 0 To hand_count(i) - 1
							'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If hand(i, j) = 0 Or (hand(i, j) > 2 And hand(i, j) < 7) Then
								'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								found = found + 1
							End If
						Next j
						
						'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If found > 1 And choice = -1 Then
							choice = 2
						Else
							choice = 1
						End If
						
						If choice = 1 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call gain_card_to_hand(i, get_id_by_name("Curse"))
						Else
							For j = 1 To 2
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_discard(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								card1 = find_best_card_to_discard(i)
								'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call append(player_names(i) & " discards " & names(hand(i, card1)))
								'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								Call discard_card(i, card1)
							Next j
						End If
					End If
				End If
			Next temp_i
			
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf names(Index) = "Trading Post" And hand_count(active_player) > 0 Then 
			If active_player = 0 Then
				phase = "trading_post"
				lblPrompt.Text = "Choose a card to trash"
				Call hide_next()
				lblPrompt.Tag = 0
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card(active_player, get_id_by_name("Silver"))
			End If
			
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf names(Index) = "Transmute" And hand_count(active_player) > 0 Then 
			If active_player = 0 Then
				phase = "transmute"
				Call hide_next()
				lblPrompt.Text = "Choose a card to trash"
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_trash(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				which_card = find_best_card_to_trash(active_player)
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				card = hand(active_player, which_card)
				Call trash_card_from_hand(active_player, which_card)
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If is_action(card) Then
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call gain_card(active_player, get_id_by_name("Duchy"))
				End If
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If gold(card) > 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call gain_card(active_player, get_id_by_name("Transmute"))
				End If
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If victory_points(card) > 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call gain_card(active_player, get_id_by_name("Gold"))
				End If
			End If
			
		ElseIf names(Index) = "Treasure Map" Then 
			' trash another treasure map from hand
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			card1 = find_card(active_player, get_id_by_name("Treasure Map"))
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If card1 > -1 And (throne_copies > 0 Or throne_card = -1) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call trash_card_from_hand(active_player, card1)
				For i = 1 To 4
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call gain_card_to_deck(active_player, get_id_by_name("Gold"))
				Next i
			End If
			
			
		ElseIf names(Index) = "Treasury" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 1)
			
		ElseIf names(Index) = "Tribute" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			card1 = -1
			opp = (active_player + 1) Mod num_players
			For i = 0 To 1
				Call min_deck(opp, 1)
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If deck_count(opp) > 0 Then
					Call append(player_names(opp) & " reveals " & names(deck(opp, 0)))
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If i = 0 Then card2 = deck(opp, 0)
					'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					card1 = deck(opp, 0)
					Call draw_cards(opp, 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call discard_card(opp, hand_count(opp) - 1)
					'UPGRADE_WARNING: Couldn't resolve default property of object card2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If i = 0 Or (i = 1 And card1 <> card2) Then
						'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If is_action(card1) = 1 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call set_actions(active_player, actions + 2)
						End If
						'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If gold(card1) > 0 Then
							'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							Call set_coins(active_player, coins + 2)
						End If
						'UPGRADE_WARNING: Couldn't resolve default property of object card1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If victory_points(card1) > 0 Then
							Call draw_cards(active_player, 2)
						End If
					End If
				End If
			Next i
			
		ElseIf names(Index) = "University" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 2)
			If find_best_card_for_university > -1 Then
				If active_player = 0 Then
					phase = "university"
					lblPrompt.Text = "Choose an action costing up to 5 to gain"
					Call hide_next()
					Call show_next("Gain Nothing")
				Else
					Call gain_card(active_player, find_best_card_for_university)
				End If
			End If
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		ElseIf names(Index) = "Upgrade" And hand_count(active_player) > 0 Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			If active_player = 0 Then
				phase = "upgrade"
				Call hide_next()
				lblPrompt.Text = "Choose a card to trash"
			End If
			
		ElseIf names(Index) = "Village" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 2)
			
		ElseIf names(Index) = "Warehouse" Then 
			Call draw_cards(active_player, 3)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			If active_player > 0 Then
				For i = 0 To 2
					Call discard_worst_card(active_player)
				Next i
			Else
				phase = "warehouse"
				lblPrompt.Text = "Choose a card to discard"
				Call hide_next()
			End If
			
		ElseIf names(Index) = "Wharf" Then 
			Call draw_cards(active_player, 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			
		ElseIf names(Index) = "Wishing Well" Then 
			Call draw_cards(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			Call min_deck(active_player, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If deck_count(active_player) = 0 Then Exit Sub
			If active_player = 0 Then
				phase = "wishing_well"
				lblPrompt.Text = "Guess a card by clicking a supply pile"
			Else
				If deck(active_player, 0) < 3 Then
					Call append(player_names(active_player) & " guesses " & names(deck(active_player, 0)))
					Call append(player_names(active_player) & " reveals " & names(deck(active_player, 0)))
					Call draw_cards(active_player, 1)
				Else
					Call append(player_names(active_player) & " guesses Copper")
					Call append(player_names(active_player) & " reveals " & names(deck(active_player, 0)))
				End If
			End If
			
		ElseIf names(Index) = "Witch" Then 
			Call play_sound("witch.wav")
			Call draw_cards(active_player, 2)
			For i = active_player + 1 To active_player + num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Mod has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
				opp = i Mod num_players
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(opp). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(opp) = 0 Then
					Call gain_card(opp, 6)
				End If
			Next i
			
		ElseIf names(Index) = "Woodcutter" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			
		ElseIf names(Index) = "Workshop" Then 
			If active_player = 0 Then
				phase = "workshop"
				lblPrompt.Text = "Choose a card costing up to 4 to gain"
				Call hide_next()
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_for_cost(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card(active_player, find_best_card_for_cost(4, 0))
			End If
			
		End If
	End Sub
	
	Private Function coins_available() As Object
		Dim avail, coins As Object
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object avail. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		avail = coins
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To hand_count(active_player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Potion). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If (hand(active_player, i) <> get_id_by_name("Potion")) Then
				If names(hand(active_player, i)) = "Phil's Stone" Then
					'UPGRADE_WARNING: Couldn't resolve default property of object avail. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					avail = avail + gold(hand(active_player, i))
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object avail. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					avail = avail + Int((discard_count(active_player) + deck_count(active_player)) / 5)
				End If
			End If
		Next i
		'UPGRADE_WARNING: Couldn't resolve default property of object avail. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object coins_available. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		coins_available = avail
	End Function
	
	Private Sub move_played_card(ByVal Index As Short)
		Dim card As Short
		card = hand(active_player, Index)
		If names(card) = "Feast" Or names(card) = "Embargo" Or names(card) = "Treasure Map" Then
			Call trash_card_from_hand(active_player, Index)
		ElseIf names(card) = "Island" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object island_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			island(active_player, island_count(active_player) + 1) = -1
			'UPGRADE_WARNING: Couldn't resolve default property of object island_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			island(active_player, island_count(active_player)) = card
			Call remove_card_from_hand(active_player, Index)
		Else
			Call move_from_hand_to_limbo(active_player, Index)
		End If
	End Sub
	
	Private Function get_best_card_prev_gained() As Object
		Dim prev_player As Short
		prev_player = (active_player + num_players - 1) Mod num_players
		
		'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(prev_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If gained_count(prev_player) = 0 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object get_best_card_prev_gained. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			get_best_card_prev_gained = -1
			'    MsgBox "Nothing gained by " & prev_player
			Exit Function
		End If
		
		Dim max_cost, max_index As Object
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object max_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		max_cost = -1
		'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(prev_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To gained_count(prev_player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object max_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If costs(gained(prev_player, i)) > max_cost And potions(gained(prev_player, i)) = 0 And costs(gained(prev_player, i)) < 7 And pile_size(gained(prev_player, i)) > 0 Then
				If active_player <> 0 And never_buy(gained(prev_player, i)) = 1 Then
					'do nothing if we never want that card
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object max_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					max_cost = costs(gained(prev_player, i))
					'UPGRADE_WARNING: Couldn't resolve default property of object max_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					max_index = i
				End If
			End If
		Next i
		
		'UPGRADE_WARNING: Couldn't resolve default property of object max_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If max_cost = -1 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object get_best_card_prev_gained. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			get_best_card_prev_gained = -1
			Exit Function
		End If
		
		'UPGRADE_WARNING: Couldn't resolve default property of object max_index. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		get_best_card_prev_gained = gained(prev_player, max_index)
		
	End Function
	
	Private Function find_best_card_for_university() As Object
		Dim id As Object
		Dim i As Short
		For i = num_actions + 7 To 0 Step -1
			'UPGRADE_WARNING: Couldn't resolve default property of object id. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			id = id_by_pile(i)
			'UPGRADE_WARNING: Couldn't resolve default property of object id. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If costs(id) <= 5 And potions(id) = 0 And never_buy(id) <> 1 And is_action(id) And pile_size(id) > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object id. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_for_university. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				find_best_card_for_university = id
				Exit Function
			End If
		Next i
		'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_for_university. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		find_best_card_for_university = -1
	End Function
	
	Private Sub discard_worst_card(ByVal player As Short)
		Dim card_index As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_discard(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		card_index = find_best_card_to_discard(player)
		Call append(player_names(player) & " discards " & names(hand(player, card_index)))
		Call discard_card(player, card_index)
	End Sub
	
	Private Sub gain_card_to_hand(ByVal player As Short, ByVal card As Short)
		Dim orig_discard_count As Object
		Dim actual_player As Short
		actual_player = player
		If possessed = 1 Then actual_player = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object orig_discard_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		orig_discard_count = discard_count(actual_player)
		Call gain_card(player, card)
		'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(actual_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object orig_discard_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If orig_discard_count < discard_count(actual_player) Then
			Call add_card_to_hand(actual_player, card)
			'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			discard(actual_player, discard_count(actual_player) - 1) = -1
			Call update_button_text()
		End If
	End Sub
	
	Private Sub gain_card_to_deck(ByVal player As Short, ByVal card As Short)
		Dim orig_discard_count As Object
		Dim actual_player As Short
		actual_player = player
		If possessed = 1 Then actual_player = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object orig_discard_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		orig_discard_count = discard_count(actual_player)
		Call gain_card(player, card)
		'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(actual_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object orig_discard_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If orig_discard_count < discard_count(actual_player) Then
			Call put_on_top_of_deck(actual_player, card, 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			discard(actual_player, discard_count(actual_player) - 1) = -1
			Call update_button_text()
		End If
	End Sub
	
	Private Sub gain_card(ByVal player As Short, ByVal card As Short)
		If pile_size(card) > 0 Then
			If phase = "buy" Then
				Call append(player_names(player) & " buys " & names(card))
			Else
				Call append(player_names(player) & " gains " & names(card))
			End If
			If possessed = 1 Then
				Call add_card_to_discard(0, card)
			Else
				Call add_card_to_discard(player, card)
			End If
			pile_size(card) = pile_size(card) - 1
			If player = active_player Then
				'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				gained(player, gained_count(player) + 1) = -1
				'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				gained(player, gained_count(player)) = card
				If player > 0 And phase <> "buy" Then
					Call add_ai_play(card, 1)
				End If
			End If
			Call update_button_text()
		End If
	End Sub
	
	Private Sub put_deck_into_discard_pile(ByVal player As Short)
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To deck_count(player)
			Call add_card_to_discard(player, deck(player, i))
		Next i
		deck(player, 0) = -1
		Call append(player_names(active_player) & " puts his deck into his discard pile")
	End Sub
	
	Private Sub discard_card(ByVal player As Short, ByVal Index As Short)
		Call add_card_to_discard(player, hand(player, Index))
		Call remove_card_from_hand(player, Index)
	End Sub
	
	'UPGRADE_NOTE: protected was upgraded to protected_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
	Private Function protected_Renamed(ByVal player As Short) As Object
		'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		protected_Renamed = 0
		
		If player = active_player Then
			'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			protected_Renamed = 0
			Exit Function
		End If
		
		If Campaign.scenario_selected = 7 And player <> 0 Then
			Call append(player_names(player) & " is protected by a ghostly aura")
			'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			protected_Renamed = 1
			Exit Function
		End If
		
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object find_card(player, get_id_by_name(Moat)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If find_card(player, get_id_by_name("Moat")) > -1 Then
			Call append(player_names(player) & " is protected by Moat")
			'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			protected_Renamed = 1
			Exit Function
		End If
		
		' check for a lighthouse as well
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To limbo_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Lighthouse). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If limbo(player, i) = get_id_by_name("Lighthouse") Then
				Call append(player_names(player) & " is protected by Lighthouse")
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				protected_Renamed = 1
				Exit Function
			End If
		Next i
		
	End Function
	
	Private Sub put_on_top_of_deck(ByVal player As Short, ByVal Index As Short, ByVal display As Short)
		Dim i As Object
		Dim count As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		count = deck_count(player)
		For i = count + 1 To 1 Step -1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck(player, i) = deck(player, i - 1)
		Next i
		deck(player, 0) = Index
		If display = 1 Then
			Call append(player_names(player) & " puts " & names(Index) & " on top of deck")
		End If
		Call refresh_lists()
	End Sub
	
	Private Sub trash_card_from_hand(ByVal player As Short, ByVal Index As Short)
		Call append(player_names(player) & " trashed " & names(hand(player, Index)))
		Call remove_card_from_hand(player, Index)
	End Sub
	
	Private Sub remove_card_from_hand(ByVal player As Short, ByVal Index As Short)
		Dim i As Object
		Dim count As Short
		'MsgBox "removing card " & index & " from " & player
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		count = hand_count(player)
		For i = Index To count
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hand(player, i) = hand(player, i + 1)
		Next i
		Call refresh_lists()
		'MsgBox "hand count is now " & hand_count(player)
	End Sub
	
	Private Sub remove_card_from_deck(ByVal player As Short, ByVal Index As Short)
		Dim i As Object
		Dim count As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		count = deck_count(player)
		For i = Index To count
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck(player, i) = deck(player, i + 1)
		Next i
		Call refresh_lists()
	End Sub
	
	Private Sub remove_card_from_limbo(ByVal player As Short, ByVal Index As Short)
		Dim i As Object
		Dim count As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		count = limbo_count(player)
		For i = Index To count
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			limbo(player, i) = limbo(player, i + 1)
		Next i
		Call refresh_lists()
	End Sub
	
	
	Private Sub move_limbo_cards_to_discard(ByVal player As Short, ByVal starting_where As Short)
		' move all new cards from limbo to discard
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = starting_where To limbo_count(player) - 1
			Call add_card_to_discard(player, limbo(player, i))
		Next i
		limbo(player, starting_where) = -1
		Call refresh_lists()
	End Sub
	
	Private Function find_card(ByVal player As Short, ByVal Index As Short) As Object
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To hand_count(player) - 1
			If hand(player, i) = Index Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				find_card = i
				Exit Function
			End If
		Next i
		'UPGRADE_WARNING: Couldn't resolve default property of object find_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		find_card = -1
	End Function
	
	Private Sub play_game()
		
		' if we are in the middle of golem, then resolve the 2nd golem card
		'UPGRADE_WARNING: Couldn't resolve default property of object golem_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If phase = "action" And golem_card > 0 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object golem_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call add_card_to_hand(active_player, golem_card)
			'UPGRADE_WARNING: Couldn't resolve default property of object golem_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action(active_player, golem_card). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If can_play_action(active_player, golem_card) Then actions = actions + 1
			'UPGRADE_WARNING: Couldn't resolve default property of object golem_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			golem_card = 0
			doing_golem = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			play_action((hand(active_player, hand_count(active_player) - 1)))
			doing_golem = 0
		End If
		
		' if throne room is in play, then copy the card
		'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If phase = "action" And throne_copies > 0 Then
			If throne_original_played = 0 Then
				'MsgBox "Playing original of " & names(throne_card) & " count = " & throne_copies
				play_action((throne_card))
				Exit Sub
			Else
				'MsgBox "Playing copy of " & names(throne_card) & " count = " & throne_copies
				'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				throne_copies = throne_copies - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call set_actions(active_player, actions - 1)
				play_action((throne_card))
				Exit Sub
			End If
		End If
		
		If active_player = 0 Then
			
			' do nothing.  Events are druven by button clicks
			If phase = "action" Then
				imgDetails.Image = System.Drawing.Image.FromFile(My.Application.Info.DirectoryPath & "/images/graphic_deck.jpg")
				Call show_prompt("Choose an action to play")
				Call show_next("Done playing actions")
				'UPGRADE_WARNING: Couldn't resolve default property of object can_play_actions(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If can_play_actions(active_player) = 0 And settings.chkAutoEnd.CheckState = 1 Then
					move_to_buy_phase((active_player))
				End If
			End If
		Else
			If phase = "action" Then
				Call AI_play_action()
				Call play_game()
			ElseIf phase = "buy" Then 
				'MsgBox "About to go to AI buy phase"
				Call AI_buy_card()
				Call play_game()
			ElseIf phase = "cleanupAI" Then 
				Call cleanup()
				Call play_game()
			End If
			
		End If
	End Sub
	
	
	
	Private Sub end_game()
		Dim total, k, i, j, total_size, vp As Object
		Dim max As Short
		'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
		Dim str_Renamed As Object
		Dim str2 As String
		phase = "end_game"
		game_ended = 1
		max = -99
		max_player = 0
		
		' Check for achievements
		Call achievements.initialize()
		
		' add up all victory points
		For i = 0 To num_players - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object total. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			total = 0
			'UPGRADE_WARNING: Couldn't resolve default property of object total_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			total_size = 0
			
			' count deck size
			For j = 0 To 7 + num_all_actions
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object total_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				total_size = total_size + count_all_zones_by_id(i, j)
			Next j
			
			' deck size > 60
			'UPGRADE_WARNING: Couldn't resolve default property of object total_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(2). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If i = 0 And achievements.get_unlocked(2) <> 1 And total_size >= 60 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str_Renamed = str_Renamed & achievements.do_unlock(2)
			End If
			
			For j = 0 To 7 + num_all_actions
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If victory_points(j) <> 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object vp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					vp = victory_points(j)
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If names(j) = "Gardens" Then
						'UPGRADE_WARNING: Couldn't resolve default property of object total_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object vp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						vp = Int(total_size / 10)
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					ElseIf names(j) = "Duke" Then 
						'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object vp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						vp = count_all_zones_by_id(i, get_id_by_name("Duchy"))
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					ElseIf names(j) = "Vineyard" Then 
						'UPGRADE_WARNING: Couldn't resolve default property of object vp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						vp = 0
						For k = 0 To 7 + num_all_actions
							'UPGRADE_WARNING: Couldn't resolve default property of object k. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							If is_action(k) Then
								'UPGRADE_WARNING: Couldn't resolve default property of object k. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								'UPGRADE_WARNING: Couldn't resolve default property of object vp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
								vp = vp + count_all_zones_by_id(i, k)
							End If
						Next k
						'MsgBox "Found " & vp & "actions"
						'UPGRADE_WARNING: Couldn't resolve default property of object vp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						vp = Int(vp / 3)
					End If
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object vp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object total. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					total = total + vp * count_all_zones_by_id(i, j)
				End If
			Next j
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object total. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			vps(i) = total
			'UPGRADE_WARNING: Couldn't resolve default property of object total. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			str2 = str2 & player_names(i) & " scored " & total & Chr(13)
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object total. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If total > max Or (total = max And turn_order(i) > turn_order(max_player)) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object total. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				max = total
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				max_player = i
			End If
		Next i
		
		'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		str_Renamed = "The game has ended!" & Chr(13)
		If Campaign.scenario_selected > 0 Then
			If scenario_end_game = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str_Renamed = "You have achieved your goal."
				max_player = 0
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str_Renamed = "You have failed to achieve your goal."
				max_player = -1
			End If
		Else
			'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			str_Renamed = str_Renamed & "The winner is " & player_names(max_player)
		End If
		'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		str_Renamed = str_Renamed & Chr(13) & Chr(13) & str2
		
		Dim got_all As Short
		If num_players = 4 And num_piles_to_exhaust = 3 And num_actions = 10 And victory_count = 12 And action_count = 10 Then
			
			'provinces
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, 5). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If achievements.get_unlocked(1) <> 1 And count_all_zones_by_id(0, 5) > 5 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str_Renamed = str_Renamed & achievements.do_unlock(1)
			End If
			
			'curses
			'UPGRADE_WARNING: Couldn't resolve default property of object bought_curses. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(6). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If achievements.get_unlocked(6) <> 1 And bought_curses > 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str_Renamed = str_Renamed & achievements.do_unlock(6)
			End If
			
			' attack of the clones
			'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(9). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If achievements.get_unlocked(9) <> 1 And player_names(0) = player_names(1) And player_names(0) = player_names(2) And player_names(0) = player_names(3) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str_Renamed = str_Renamed & achievements.do_unlock(9)
			End If
			
			' kill all copper
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, 0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(5). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If achievements.get_unlocked(5) <> 1 And count_all_zones_by_id(0, 0) = 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str_Renamed = str_Renamed & achievements.do_unlock(5)
			End If
			
			' 1 of everything
			got_all = 1
			For i = 0 To num_actions + 6
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, id_by_pile(i)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If count_all_zones_by_id(0, id_by_pile(i)) = 0 Then
					got_all = 0
				End If
			Next i
			'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(7). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If achievements.get_unlocked(7) <> 1 And got_all = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str_Renamed = str_Renamed & achievements.do_unlock(7)
			End If
			
			' got all of something
			For i = 7 To num_actions + 6
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, id_by_pile(i)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(3). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If achievements.get_unlocked(3) <> 1 And is_action(id_by_pile(i)) And count_all_zones_by_id(0, id_by_pile(i)) = 10 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					str_Renamed = str_Renamed & achievements.do_unlock(3)
				End If
			Next i
			
			' some only trigger when you win
			If max_player = 0 Then
				' 5 in a row
				win_streak = win_streak + 1
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If achievements.get_unlocked(0) <> 1 And win_streak = 5 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					str_Renamed = str_Renamed & achievements.do_unlock(0)
				End If
				
				' did nothing
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(4). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If achievements.get_unlocked(4) <> 1 And did_anything = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					str_Renamed = str_Renamed & achievements.do_unlock(4)
				End If
				
				' bought no actions
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(8). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If achievements.get_unlocked(8) <> 1 And bought_actions = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					str_Renamed = str_Renamed & achievements.do_unlock(8)
				End If
				
				' bought no coins
				'UPGRADE_WARNING: Couldn't resolve default property of object bought_coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object achievements.get_unlocked(10). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If achievements.get_unlocked(10) <> 1 And bought_coins = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object achievements.do_unlock(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					str_Renamed = str_Renamed & achievements.do_unlock(10)
				End If
			End If
		End If
		
		' some only trigger when you win
		If max_player = 0 Then
			Call play_sound("you_win.wav")
		Else
			Call play_sound("you_lose.wav")
			win_streak = 0
		End If
		
		' write stats to file
		Dim img_count, player_count As Object
		Dim count As Short
		Dim str3 As String
		If Campaign.scenario_selected < 1 Then
			'UPGRADE_WARNING: Dir has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			If Dir(My.Application.Info.DirectoryPath & "/stats_date.txt") = "" Then
				FileCopy(My.Application.Info.DirectoryPath & "/stats_blank.txt", My.Application.Info.DirectoryPath & "/stats_date.txt")
			End If
			FileOpen(1, My.Application.Info.DirectoryPath & "/stats_date.txt", OpenMode.Append)
			'UPGRADE_WARNING: DateValue has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
			str3 = DateValue(CStr(Now)) & Chr(System.Windows.Forms.Keys.Tab) & TimeValue(CStr(Now)) & Chr(System.Windows.Forms.Keys.Tab)
			For i = 0 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If turn_order(i) = 0 Then str3 = str3 & i + 1 & Chr(System.Windows.Forms.Keys.Tab)
			Next i
			str3 = str3 & num_players & Chr(System.Windows.Forms.Keys.Tab)
			
			For i = 0 To 5
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str3 = str3 & player_names(i) & Chr(System.Windows.Forms.Keys.Tab)
			Next i
			str3 = str3 & max_player + 1 & Chr(System.Windows.Forms.Keys.Tab)
			For i = 0 To 5
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				str3 = str3 & vps(i) & Chr(System.Windows.Forms.Keys.Tab)
			Next i
			str3 = str3 & num_actions & Chr(System.Windows.Forms.Keys.Tab)
			str3 = str3 & num_piles_to_exhaust & Chr(System.Windows.Forms.Keys.Tab)
			str3 = str3 & action_count & Chr(System.Windows.Forms.Keys.Tab)
			str3 = str3 & victory_count & Chr(System.Windows.Forms.Keys.Tab)
			For i = 0 To 11
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If i < num_actions Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					str3 = str3 & names(action_cards(i)) & Chr(System.Windows.Forms.Keys.Tab)
				Else
					str3 = str3 & "N/A" & Chr(System.Windows.Forms.Keys.Tab)
				End If
			Next i
			For i = 0 To 5
				For j = 0 To 6 + 12
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If j - 7 >= num_actions Or i >= num_players Then
						str3 = str3 & "N/A" & Chr(System.Windows.Forms.Keys.Tab)
					Else
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						str3 = str3 & count_all_zones_by_id(i, id_by_pile(j)) & Chr(System.Windows.Forms.Keys.Tab)
					End If
				Next j
			Next i
			PrintLine(1, str3)
			FileClose(1)
		End If
		
		' show everyone's deck
		Call hide_choices()
		If imgWhite.Visible = False Then
			imgWhite.BringToFront()
			lblPrompt2.Visible = True
			imgWhite.Visible = True
			For i = 0 To 6 + num_actions
				imgSupply(i).Visible = False
			Next i
		End If
		
		imgDetails.Visible = False
		txtLog.Visible = False
		lblPrompt2.Text = "Final Deck Compositions: "
		Call imgWhite.SetBounds(VB6.TwipsToPixelsX(50), imgWhite.Top, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
		imgWhite.Width = VB6.TwipsToPixelsX(15000)
		imgWhite.Height = VB6.TwipsToPixelsY(12000)
		Call imgOpponentPlayed(0).SetBounds(VB6.TwipsToPixelsX(300), VB6.TwipsToPixelsY(900), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
		
		'UPGRADE_WARNING: Couldn't resolve default property of object img_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		img_count = 0
		For i = 0 To num_players - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If i > lblFinalNames.UBound Then lblFinalNames.Load(i)
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			lblFinalNames(i).Text = player_names(i)
			lblFinalNames(i).Visible = True
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call lblFinalNames(i).SetBounds(VB6.TwipsToPixelsX(300 + 2500 * i), VB6.TwipsToPixelsY(500), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			lblFinalNames(i).BringToFront()
			
			'UPGRADE_WARNING: Couldn't resolve default property of object player_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			player_count = 0
			For j = 0 To num_all_actions + 6
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				count = count_all_zones_by_id(i, j)
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If count > 0 And victory_points(j) <> 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object img_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If img_count > lblFinalCount.UBound Then lblFinalCount.Load(img_count)
					'UPGRADE_WARNING: Couldn't resolve default property of object img_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If img_count > imgOpponentPlayed.UBound Then
						imgOpponentPlayed.Load(img_count)
					End If
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					imgOpponentPlayed(img_count).Tag = j
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					imgOpponentPlayed(img_count).Image = images(j)
					'UPGRADE_WARNING: Couldn't resolve default property of object player_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call imgOpponentPlayed(img_count).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentPlayed(0).Left) + 2500 * i), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentPlayed(0).Top) + 400 * player_count), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
					imgOpponentPlayed(img_count).BringToFront()
					imgOpponentPlayed(img_count).Visible = True
					
					lblFinalCount(img_count).Text = CStr(count)
					lblFinalCount(img_count).BringToFront()
					Call lblFinalCount(img_count).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentPlayed(img_count).Left) - 220), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentPlayed(img_count).Top) + 100), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
					lblFinalCount(img_count).Visible = True
					
					'UPGRADE_WARNING: Couldn't resolve default property of object img_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					img_count = img_count + 1
					'UPGRADE_WARNING: Couldn't resolve default property of object player_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					player_count = player_count + 1
				End If
			Next j
			For j = 0 To num_all_actions + 6
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				count = count_all_zones_by_id(i, j)
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If count > 0 And victory_points(j) = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object img_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If img_count > lblFinalCount.UBound Then lblFinalCount.Load(img_count)
					'UPGRADE_WARNING: Couldn't resolve default property of object img_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If img_count > imgOpponentPlayed.UBound Then
						imgOpponentPlayed.Load(img_count)
					End If
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					imgOpponentPlayed(img_count).Tag = j
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					imgOpponentPlayed(img_count).Image = images(j)
					'UPGRADE_WARNING: Couldn't resolve default property of object player_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call imgOpponentPlayed(img_count).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentPlayed(0).Left) + 2500 * i), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentPlayed(0).Top) + 400 * player_count), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
					imgOpponentPlayed(img_count).BringToFront()
					imgOpponentPlayed(img_count).Visible = True
					
					lblFinalCount(img_count).Text = CStr(count)
					lblFinalCount(img_count).BringToFront()
					Call lblFinalCount(img_count).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentPlayed(img_count).Left) - 220), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentPlayed(img_count).Top) + 100), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
					lblFinalCount(img_count).Visible = True
					
					'UPGRADE_WARNING: Couldn't resolve default property of object img_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					img_count = img_count + 1
					'UPGRADE_WARNING: Couldn't resolve default property of object player_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					player_count = player_count + 1
				End If
			Next j
		Next i
		
		
		If Campaign.scenario_selected > 0 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			str_Renamed = str_Renamed & Chr(13) & Chr(13) & "Contnue Campaign?"
		Else
			'UPGRADE_WARNING: Couldn't resolve default property of object str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			str_Renamed = str_Renamed & Chr(13) & Chr(13) & "Play Again?"
		End If
		
		Dim intResult As Short
		intResult = MsgBox(str_Renamed, MsgBoxStyle.YesNo)
		If intResult = MsgBoxResult.No Then
			End
		Else
			imgWhite.SendToBack()
			imgWhite.Left = VB6.TwipsToPixelsX(3360)
			imgWhite.Width = VB6.TwipsToPixelsX(8520)
			imgWhite.Height = VB6.TwipsToPixelsY(4740)
			imgOpponentPlayed(0).Left = VB6.TwipsToPixelsX(3600)
			imgDetails.Visible = True
			txtLog.Visible = True
			'UPGRADE_WARNING: Couldn't resolve default property of object img_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For i = 0 To img_count - 1
				lblFinalCount(i).Visible = False
			Next i
			For i = 0 To num_players - 1
				lblFinalNames(i).Visible = False
			Next i
			Call hide_choices()
			
			If Campaign.scenario_selected > 0 Then
				Campaign.Show()
				Call Campaign.Campaign_Load(Nothing, New System.EventArgs())
			Else
				settings.Show()
			End If
			Me.Hide()
		End If
		
	End Sub
	
	Private Function count_all_zones_by_id(ByVal player As Short, ByVal id As Short) As Object
		Dim i As Object
		Dim count As Short
		count = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To deck_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If deck(player, i) = id Then
				count = count + 1
			End If
		Next i
		'MsgBox "After deck: " & count
		
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To hand_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If hand(player, i) = id Then
				count = count + 1
			End If
		Next i
		'MsgBox "After hand: " & count
		
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To limbo_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If limbo(player, i) = id Then
				count = count + 1
			End If
		Next i
		'MsgBox "After limbo: " & count
		
		'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To discard_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If discard(player, i) = id Then
				count = count + 1
			End If
		Next i
		'MsgBox "After discard: " & count
		
		'UPGRADE_WARNING: Couldn't resolve default property of object village_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To village_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If native_village(player, i) = id Then
				count = count + 1
			End If
		Next i
		
		'UPGRADE_WARNING: Couldn't resolve default property of object haven_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To haven_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If haven(player, i) = id Then
				count = count + 1
			End If
		Next i
		
		'UPGRADE_WARNING: Couldn't resolve default property of object island_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To island_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If island(player, i) = id Then
				count = count + 1
			End If
		Next i
		
		'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		count_all_zones_by_id = count
	End Function
	
	Private Sub AI_play_action()
		'UPGRADE_WARNING: Couldn't resolve default property of object can_play_actions(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If can_play_actions(active_player) = 0 Then
			move_to_buy_phase((active_player))
			Exit Sub
		End If
		
		Dim best As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object find_best_action_to_play(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		best = find_best_action_to_play()
		Call add_ai_play(best, 0)
		play_action((best))
	End Sub
	
	Private Function find_best_action_to_play() As Object
		Dim sort_count, k, i, j, card, temp As Object
		Dim id As Short
		
		' play throne room if we have any
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		id = get_id_by_name("Throne Room")
		'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, id). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If find_card(active_player, id) > -1 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object find_best_action_to_play. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			find_best_action_to_play = id
			Exit Function
		End If
		
		' sort our actions by cost
		Dim sorted_actions(100) As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object sort_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		sort_count = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To hand_count(active_player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			card = hand(active_player, i)
			'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action(active_player, card). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If can_play_action(active_player, card) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object sort_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If sort_count = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					sorted_actions(0) = card
					'UPGRADE_WARNING: Couldn't resolve default property of object sort_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					sort_count = 1
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object sort_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					sorted_actions(sort_count) = card
					'UPGRADE_WARNING: Couldn't resolve default property of object sort_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					sort_count = sort_count + 1
					'UPGRADE_WARNING: Couldn't resolve default property of object sort_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					For j = sort_count - 1 To 1 Step -1
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If costs(sorted_actions(j)) + 2.5 * potions(sorted_actions(j)) > costs(sorted_actions(j - 1)) + 2.5 * potions(sorted_actions(j - 1)) Then
							'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object temp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							temp = sorted_actions(j)
							'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							sorted_actions(j) = sorted_actions(j - 1)
							'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							'UPGRADE_WARNING: Couldn't resolve default property of object temp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							sorted_actions(j - 1) = temp
						End If
					Next j
				End If
			End If
		Next i
		
		'UPGRADE_WARNING: Couldn't resolve default property of object sort_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If sort_count = 0 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object find_best_action_to_play. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			find_best_action_to_play = -1
			Exit Function
		End If
		
		' play any actions that yield more actions
		'UPGRADE_WARNING: Couldn't resolve default property of object sort_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To sort_count - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If extra_actions(sorted_actions(i)) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				find_best_action_to_play = sorted_actions(i)
				Exit Function
			End If
		Next i
		
		' play shanty town
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		id = get_id_by_name("Shanty Town")
		'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, id). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If find_card(active_player, id) > -1 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object find_best_action_to_play. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			find_best_action_to_play = id
			Exit Function
		End If
		
		' if opponent gained a card costing 5 or more, play Smugglers
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		id = get_id_by_name("Smugglers")
		'UPGRADE_WARNING: Couldn't resolve default property of object get_best_card_prev_gained(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, id). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If find_card(active_player, id) > -1 And get_best_card_prev_gained() > -1 Then
			'MsgBox "Found it " & get_best_card_prev_gained()
			'UPGRADE_WARNING: Couldn't resolve default property of object get_best_card_prev_gained(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If costs(get_best_card_prev_gained()) > 4 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_action_to_play. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				find_best_action_to_play = id
				Exit Function
			End If
		End If
		
		' play Ambassador if we have any
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		id = get_id_by_name("Ambassador")
		'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, id). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If find_card(active_player, id) > -1 And can_play_action(active_player, id) Then
			'UPGRADE_WARNING: Couldn't resolve default property of object find_best_action_to_play. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			find_best_action_to_play = id
			Exit Function
		End If
		
		' play the most expensive card left
		find_best_action_to_play = sorted_actions(0)
		
	End Function
	
	Private Sub AI_buy_card()
		' buy the most expensive card available
		'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If buys = 0 Then
			phase = "cleanup"
			Exit Sub
		End If
		
		Dim best_card As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_for_cost(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		best_card = find_best_card_for_cost(coins, potions_avail)
		If best_card = -1 Then
			Call add_ai_buy(-1, 1)
			phase = "cleanup"
			Exit Sub
		End If
		
		' if the card chosen is under embargo, maybe try a different card
		If Int(Rnd() * embargo(best_card)) <> 0 Then
			Call AI_buy_card()
			Exit Sub
		End If
		
		' add money to buy zone
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To limbo_count(active_player) - 1
			If gold(limbo(active_player, i)) > 0 Then
				Call add_ai_buy(limbo(active_player, i), 0)
			End If
		Next i
		
		Call add_ai_buy(best_card, 1)
		Call buy_card(best_card)
		' nothing to buy apparently
		'MsgBox "AI has " & coins & " money, but chose not to buy anything"
		phase = "cleanup"
	End Sub
	
	Private Function find_worst_card_for_cost(ByVal cost As Short, ByVal potion_cost As Short) As Object
		' find a never-buy card for this cost
		Dim i As Object
		Dim id As Short
		For i = 0 To 6 + num_actions
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			id = id_by_pile(i)
			If pile_size(id) > 0 And never_buy(id) = 1 And costs(id) = cost And potion_cost = potions(id) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_worst_card_for_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				find_worst_card_for_cost = id
				Exit Function
			End If
		Next i
		
		' otherwise just pick the first card we can
		For i = 0 To 6 + num_actions
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			id = id_by_pile(i)
			If pile_size(id) > 0 And costs(id) = cost And potion_cost = potions(id) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_worst_card_for_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				find_worst_card_for_cost = id
				Exit Function
			End If
		Next i
		
		' nothing found
		'UPGRADE_WARNING: Couldn't resolve default property of object find_worst_card_for_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		find_worst_card_for_cost = -1
		
	End Function
	
	Private Function find_best_card_for_cost(ByVal cost As Short, ByVal potion_cost As Short) As Object
		Dim i, card As Object
		Dim valid As Short
		Dim choices(100) As Short
		Dim max_choice, max As Object
		Dim id As Double
		'UPGRADE_WARNING: Couldn't resolve default property of object max_choice. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		max_choice = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		max = -1
		
		' if we have 0 potions (and 4 coins), then buy a potion
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		id = get_id_by_name("Potion")
		'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(active_player, id). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If (cost >= 4 And count_all_zones_by_id(active_player, id) = 0 And pile_size(id) > 0 And action_cards(num_actions - 1) = id) Then
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			find_best_card_for_cost = get_id_by_name("Potion")
			Exit Function
		End If
		
		' get a list of the most expensive things we can afford
		Dim adjusted_cost As Double
		For i = 0 To 6 + num_actions
			
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			id = id_by_pile(i)
			adjusted_cost = costs(id) + 2.5 * potions(id)
			
			'MsgBox "Checking... id=" & str(id) & " never_buy=" & never_buy(id)
			'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If (cost >= costs(id) And potion_cost >= potions(id)) And pile_size(id) > 0 And never_buy(id) <> 1 And adjusted_cost >= max Then
				valid = 1
				'MsgBox names(id) & " is acceptable since it costs " & costs(id)
				
				' towards the end of the game only buy victory points
				If (get_game_progress < 0.25 And victory_points(id) < 1) Then valid = 0
				
				' early in the game, never buy estat or duchy
				If get_game_progress > 0.25 And names(id) = "Estate" Then valid = 0
				If get_game_progress > 0.4 And names(id) = "Duchy" Then valid = 0
				
				' do not buy duke unless we already have at least 3 duchy
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(active_player, get_id_by_name(Duchy)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If names(id) = "Duke" And count_all_zones_by_id(active_player, get_id_by_name("Duchy")) < 3 Then valid = 0
				
				If valid = 1 Then
					'MsgBox names(id) & "is valid"
					'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If max = adjusted_cost Then
						'UPGRADE_WARNING: Couldn't resolve default property of object max_choice. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						choices(max_choice) = id
						'UPGRADE_WARNING: Couldn't resolve default property of object max_choice. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						max_choice = max_choice + 1
					Else
						choices(0) = id
						'UPGRADE_WARNING: Couldn't resolve default property of object max_choice. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						max_choice = 1
						'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						max = adjusted_cost
						'MsgBox "Better was found so max now = " & max
					End If
				End If
			End If
		Next i
		
		' if nothing was found to buy, try again without the restrictions
		'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If max = -1 Then
			For i = 0 To 6 + num_actions
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				id = id_by_pile(i)
				'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If cost >= costs(id) And pile_size(id) > 0 And never_buy(id) <> 1 And costs(id) >= max Then
					'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If max = costs(id) Then
						' do not add ambassador if we don't have any curses
						'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Ambassador). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(active_player, 6). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If count_all_zones_by_id(active_player, 6) = 0 And id = get_id_by_name("Ambassador") Then
							' do nothing
						Else
							'UPGRADE_WARNING: Couldn't resolve default property of object max_choice. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							choices(max_choice) = id
							'UPGRADE_WARNING: Couldn't resolve default property of object max_choice. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
							max_choice = max_choice + 1
						End If
					Else
						choices(0) = id
						'UPGRADE_WARNING: Couldn't resolve default property of object max_choice. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						max_choice = 1
						'UPGRADE_WARNING: Couldn't resolve default property of object max. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						max = costs(id)
					End If
				End If
			Next i
		End If
		
		'UPGRADE_WARNING: Couldn't resolve default property of object max_choice. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If max_choice = 0 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_for_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			find_best_card_for_cost = -1
			Exit Function
		End If
		
		' randomly choose from among the best cards
		'UPGRADE_WARNING: Couldn't resolve default property of object max_choice. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		i = Int(Rnd() * max_choice)
		'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		find_best_card_for_cost = choices(i)
	End Function
	
	Private Sub set_buys(ByRef player As Short, ByRef num As Short)
		'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		buys = num
		If player = 0 Then
			lblBuys.Text = "Buys: " & num
		End If
	End Sub
	
	Private Sub set_actions(ByRef player As Short, ByRef num As Short)
		'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		actions = num
		If player = 0 Then
			lblActions.Text = "Actions: " & num
		End If
	End Sub
	
	Private Sub set_coins(ByVal player As Short, ByVal num As Short)
		'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		coins = num
		If player = 0 Then
			lblCoins.Text = "Coins: " & num
			If potions_avail > 0 Then
				lblCoins.Text = lblCoins.Text & " (" & potions_avail & " potions)"
			End If
		End If
	End Sub
	
	Private Sub move_to_buy_phase(ByVal player As Short)
		lblPrompt.Text = "Choose a card to buy"
		If player = 0 Then
			Call show_next("Done Buying")
		End If
		phase = "buy"
		Call set_actions(player, 0)
		
		'move coins from hand to limbo and increment coin count
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = hand_count(player) - 1 To 0 Step -1
			If gold(hand(player, i)) > 0 Then
				If names(hand(player, i)) = "Potion" Then
					potions_avail = potions_avail + 1
					'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call set_coins(player, coins)
				ElseIf names(hand(player, i)) = "Phil's Stone" Then 
					'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call set_coins(player, coins + Int((discard_count(active_player) + deck_count(active_player)) / 5))
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call set_coins(player, coins + gold(hand(player, i)))
					If names(hand(player, i)) = "Copper" And coppersmith_played > 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call set_coins(player, coins + coppersmith_played)
					End If
				End If
				Call move_from_hand_to_limbo(player, i)
			End If
		Next i
		
	End Sub
	
	Private Sub move_from_hand_to_limbo(ByRef player As Short, ByRef Index As Short)
		Dim count As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		count = limbo_count(player)
		limbo(player, count) = hand(player, Index)
		limbo(player, count + 1) = -1
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = Index To hand_count(player) - 1
			hand(player, i) = hand(player, i + 1)
		Next i
		Call refresh_lists()
	End Sub
	
	Private Sub add_card_to_hand(ByVal player As Short, ByVal Index As Short)
		Dim hand_size As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		hand_size = hand_count(player)
		hand(player, hand_size) = Index
		hand(player, hand_size + 1) = -1
		Call refresh_lists()
	End Sub
	
	Private Sub add_card_to_limbo(ByVal player As Short, ByVal Index As Short)
		Dim limbo_size As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		limbo_size = limbo_count(player)
		limbo(player, limbo_size) = Index
		limbo(player, limbo_size + 1) = -1
		Call refresh_lists()
	End Sub
	
	Private Sub add_card_to_discard(ByVal player As Short, ByVal Index As Short)
		Dim discard_size As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		discard_size = discard_count(player)
		'MsgBox "Setting discard(" & discard_size & " ) to " & index
		discard(player, discard_size) = Index
		discard(player, discard_size + 1) = -1
		'Call append( player_names(player) & " discards " & names(index))
		Call refresh_lists()
	End Sub
	
	
	Private Sub game_KeyDown(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
		Dim KeyCode As Short = eventArgs.KeyCode
		Dim Shift As Short = eventArgs.KeyData \ &H10000
		If KeyCode = System.Windows.Forms.Keys.Space And cmdContinue.Visible = True And max_player = -1 Then
			Call cmdContinue_Click(cmdContinue, New System.EventArgs())
		End If
	End Sub
	
	Private Sub herbalist_cleanup(ByVal herbalist_count As Short)
		Dim i As Object
		Dim j As Short
		Dim max_gold As Object
		Dim max_index As Short
		If active_player = 0 Then
			Call show_prompt("Herbalist: Choose a treasure to reclaim")
			Call show_next("Done")
			imgNext.Tag = herbalist_count
			'UPGRADE_WARNING: Couldn't resolve default property of object herbalist_complete. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			herbalist_complete = 1
			phase = "herbalist"
		Else
			For j = 0 To herbalist_count - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object max_gold. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				max_gold = 0
				max_index = 0
				'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For i = 0 To limbo_count(active_player) - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object max_gold. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If gold(limbo(active_player, i)) > max_gold Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object max_gold. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						max_gold = gold(limbo(active_player, i))
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						max_index = i
					End If
				Next i
				'UPGRADE_WARNING: Couldn't resolve default property of object max_gold. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If max_gold > 1 Then
					Call put_on_top_of_deck(active_player, limbo(active_player, max_index), 1)
					Call remove_card_from_limbo(active_player, max_index)
				End If
			Next j
		End If
		
	End Sub
	
	Private Sub cleanup()
		Dim i, j As Object
		Dim player As Short
		Dim durations(20) As Short
		Dim duration_counter, throne_stack As Object
		Dim was_duration As Short
		
		phase = "Cleanup"
		player = active_player
		
		' see if any potions were played this turn
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To limbo_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If names(limbo(active_player, i)) = "Potion" Then
				potions_played = 1
			End If
		Next i
		
		' for each herbalist, choose a coin to save
		Dim herbalist_count As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To limbo_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If names(limbo(active_player, i)) = "Herbalist" Then
				herbalist_count = herbalist_count + 1
			End If
		Next i
		If active_player = 0 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object herbalist_complete. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If herbalist_count > 0 And herbalist_complete = 0 Then
				Call herbalist_cleanup(herbalist_count)
				Exit Sub
			End If
		Else
			Call herbalist_cleanup(herbalist_count)
		End If
		'UPGRADE_WARNING: Couldn't resolve default property of object herbalist_complete. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		herbalist_complete = 0
		
		' Undo bridges
		'UPGRADE_WARNING: Couldn't resolve default property of object bridge_built. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		bridge_built = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object bridge_built. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If costs(get_id_by_name("Province")) = 1 Then bridge_built = 1
		If bridges_played > 0 Then
			For i = 0 To 7 + num_all_actions
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				costs(i) = original_costs(i)
			Next i
			bridges_played = 0
		End If
		
		actions_played = 0
		coppersmith_played = 0
		
		' check if the game ended
		If get_game_progress = 0 And game_ended = 0 Then
			Call end_game()
			Exit Sub
		End If
		
		
		' remove prompts for human
		Call hide_prompt()
		Call hide_next()
		
		' put limbo pile into discard
		'UPGRADE_WARNING: Couldn't resolve default property of object duration_counter. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		duration_counter = 0
		
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To limbo_count(player) - 1
			' do all kinds of work to see if throne room copied a duration card
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_stack. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			throne_stack = 0
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If names(limbo(player, i)) = "Throne Room" And i >= limbo_count_at_start Then
				'UPGRADE_WARNING: Couldn't resolve default property of object throne_stack. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				throne_stack = 1
				'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For j = i + 1 To limbo_count(player) - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If names(limbo(player, j)) = "Throne Room" Then
						'UPGRADE_WARNING: Couldn't resolve default property of object throne_stack. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						throne_stack = throne_stack + 1
					Else
						'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						j = limbo_count(player)
					End If
				Next j
			End If
			
			was_duration = 0
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_stack. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If throne_stack > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object throne_stack. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If limbo_count(player) > i + 2 * throne_stack - 1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object throne_stack. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If is_duration(limbo(player, i + 2 * throne_stack - 1)) Then
						was_duration = 1
					End If
				End If
			End If
			
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If names(limbo(player, i)) = "Treasury" And bought_vp = 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call put_on_top_of_deck(player, limbo(player, i), 1)
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf names(limbo(player, i)) = "Alchemist" And potions_played = 1 Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call put_on_top_of_deck(player, limbo(player, i), 1)
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf was_duration = 0 And (is_duration(limbo(player, i)) <> 1 Or i < limbo_count_at_start) Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call add_card_to_discard(player, limbo(player, i))
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object duration_counter. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				durations(duration_counter) = limbo(player, i)
				'UPGRADE_WARNING: Couldn't resolve default property of object duration_counter. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				duration_counter = duration_counter + 1
			End If
		Next i
		'UPGRADE_WARNING: Couldn't resolve default property of object duration_counter. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To duration_counter - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			limbo(player, i) = durations(i)
		Next i
		'UPGRADE_WARNING: Couldn't resolve default property of object duration_counter. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		limbo(player, duration_counter) = -1
		
		'MsgBox "Discard size is now " & discard_count(player)
		
		'put hand into discard
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To hand_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call add_card_to_discard(player, hand(player, i))
		Next i
		hand(player, 0) = -1
		
		'MsgBox "Discard size is now " & discard_count(player)
		
		' draw 5 new cards (3 if taking an outpost turn)
		If going_to_take_extra_turn = 1 Then
			Call draw_cards(player, 3)
		Else
			Call draw_cards(player, 5)
		End If
		
		Call append(player_names(active_player) & " is done.")
		
		If active_player = 0 And going_to_take_extra_turn = 0 Then
			txtLog.Text = ""
		Else
			append(("--------------------"))
		End If
		
		' start the next turn
		'UPGRADE_WARNING: Couldn't resolve default property of object taking_extra_turn. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If going_to_take_extra_turn = 1 And taking_extra_turn = 0 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object taking_extra_turn. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			taking_extra_turn = 1
		ElseIf possessed = 1 And active_player = 1 Then 
			possessed = 0
			player_names(1) = Mid(player_names(1), 11)
		Else
			active_player = (active_player + 1) Mod num_players
			'UPGRADE_WARNING: Couldn't resolve default property of object taking_extra_turn. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			taking_extra_turn = 0
		End If
		
		lblTurn.Text = CStr(CDbl(lblTurn.Text) + 1)
		
		
		Call start_turn()
		
		play_game()
	End Sub
	
	Private Sub start_turn()
		Dim i As Short
		
		Call hide_choices()
		
		'UPGRADE_WARNING: Couldn't resolve default property of object taking_extra_turn. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If taking_extra_turn = 1 Then
			Call append(player_names(active_player) & " starts his extra turn.")
		Else
			Call append(player_names(active_player) & " starts his turn.")
		End If
		
		potions_played = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		throne_copies = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object throne_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		throne_card = -1
		throne_original_played = 0
		going_to_take_extra_turn = 0
		bought_vp = 0
		Call set_buys(active_player, 1)
		Call set_actions(active_player, 1)
		potions_avail = 0
		Call set_coins(active_player, 0)
		
		
		' take care of any duractions
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		limbo_count_at_start = limbo_count(active_player)
		If active_player > 0 Then
			For i = 0 To limbo_count_at_start - 1
				Call add_ai_play(limbo(active_player, i), 2)
			Next i
		End If
		
		
		'UPGRADE_WARNING: Couldn't resolve default property of object duration_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To duration_count(active_player) - 1
			do_duration(durations_played(active_player, i))
		Next i
		durations_played(active_player, 0) = -1
		
		
		gained(active_player, 0) = -1
		
		Call scenario_start_turn()
		
		phase = "action"
		Call refresh_lists()
		
	End Sub
	
	Private Function do_duration(ByVal Index As Short) As Object
		Dim i As Short
		If names(Index) = "Caravan" Then
			Call draw_cards(active_player, 1)
			
		ElseIf names(Index) = "Fishing Village" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 1)
			
		ElseIf names(Index) = "Haven" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object haven_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For i = 0 To haven_count(active_player) - 1
				Call add_card_to_hand(active_player, haven(active_player, i))
			Next i
			haven(active_player, 0) = -1
			
		ElseIf names(Index) = "Lighthouse" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 1)
			
		ElseIf names(Index) = "Merchant Ship" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(active_player, coins + 2)
			
		ElseIf names(Index) = "Tactician" Then 
			Call draw_cards(active_player, 5)
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_actions(active_player, actions + 1)
			
		ElseIf names(Index) = "Wharf" Then 
			Call draw_cards(active_player, 2)
			'UPGRADE_WARNING: Couldn't resolve default property of object buys. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_buys(active_player, buys + 1)
			
			
			
		End If
	End Function
	
	Private Function can_play_actions(ByRef player As Short) As Object
		' if there are actions in hand, and the player has actions, the answer is yes
		'UPGRADE_WARNING: Couldn't resolve default property of object actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If actions = 0 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object can_play_actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			can_play_actions = 0
			Exit Function
		End If
		
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To hand_count(player) - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action(player, hand(player, i)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If can_play_action(player, hand(player, i)) = 1 Then
				'MsgBox "Action can be played!  " & hand(player, i) & " = " & i & "IS_action: " & is_action(hand(player, i))
				
				'UPGRADE_WARNING: Couldn't resolve default property of object can_play_actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				can_play_actions = 1
				Exit Function
			End If
		Next i
		
		'UPGRADE_WARNING: Couldn't resolve default property of object can_play_actions. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		can_play_actions = 0
	End Function
	
	Private Function can_play_action(ByVal player As Short, ByVal Index As Short) As Object
		If is_action(Index) <> 1 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			can_play_action = 0
			Exit Function
		End If
		
		Dim i As Object
		Dim victory_card_found As Short
		
		' Card specific choices for AI
		Dim coins_found As Short
		If player <> 0 Then
			' if I won't buy this card, then don't play it
			If never_buy(Index) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				can_play_action = 0
				Exit Function
			End If
			
			' chapel / ambassador: only play when there is a curse in hand
			If names(Index) = "Chapel" Or names(Index) = "Ambassador" Then
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(player, 6). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If find_card(player, 6) = -1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					can_play_action = 0
					Exit Function
				End If
				
				' only play island is there is a victory card in hand
			ElseIf names(Index) = "Island" Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(player, 6). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(player, 5). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(player, 4). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(player, 3). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If find_card(player, 3) = -1 And find_card(player, 4) = -1 And find_card(player, 5) = -1 And find_card(player, 6) = -1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					can_play_action = 0
					Exit Function
				End If
				
				' never play remodel
			ElseIf names(Index) = "Remodel" Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				can_play_action = 0
				Exit Function
				
				' don't play lookout with fewer than 3 cards in deck
				'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf names(Index) = "Lookout" And deck_count(player) + discard_count(player) < 3 Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				can_play_action = 0
				Exit Function
				
				' mine can only be played if you have a copper or silver in hand,
				' and the next highest coin is available
			ElseIf names(Index) = "Mine" Then 
				coins_found = 0
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, 1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If find_card(active_player, 1) > -1 And pile_size(2) > 0 Then
					coins_found = 1
					'UPGRADE_WARNING: Couldn't resolve default property of object find_card(active_player, 0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				ElseIf find_card(active_player, 0) > -1 And pile_size(1) > 0 Then 
					coins_found = 1
				End If
				If coins_found = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					can_play_action = 0
					Exit Function
				End If
				
				' don't play moneylender without a copper
			ElseIf names(Index) = "Moneylender" Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(player, 0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If find_card(player, 0) = -1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					can_play_action = 0
					Exit Function
				End If
				
				' don't play Outpost if we're on an extra turn
				'UPGRADE_WARNING: Couldn't resolve default property of object taking_extra_turn. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf names(Index) = "Outpost" And taking_extra_turn = 1 Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				can_play_action = 0
				Exit Function
				
				' only play smugglers if AI got something worth more than 0
				'UPGRADE_WARNING: Couldn't resolve default property of object get_best_card_prev_gained(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf names(Index) = "Smugglers" And get_best_card_prev_gained() < 1 Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				can_play_action = 0
				Exit Function
				
				' remodel / ambassador / salvagers / island / trading post / upgrade need a card in hand to play
			ElseIf names(Index) = "Remodel" Or names(Index) = "Ambassador" Or names(Index) = "Salvager" Or names(Index) = "Island" Or names(Index) = "Trading Post" Or names(Index) = "Upgrade" Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If hand_count(player) = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					can_play_action = 0
					Exit Function
				End If
			End If
		End If
		
		If names(Index) = "Throne Room" Then
			' only play throne room when there is another action in hand that we can play
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For i = 0 To hand_count(player) - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If names(hand(player, i)) <> "Throne Room" Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action(player, hand(player, i)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If can_play_action(player, hand(player, i)) Then
						'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						can_play_action = 1
						Exit Function
					End If
				End If
			Next i
			'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			can_play_action = 0
			Exit Function
		End If
		
		'UPGRADE_WARNING: Couldn't resolve default property of object can_play_action. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		can_play_action = 1
	End Function
	
	Private Sub msgbox_hand(ByVal player As Short)
		'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
		Dim str_Renamed As String
		str_Renamed = "Hand is: " & Chr(13)
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To hand_count(player) - 1
			str_Renamed = str_Renamed & names(hand(player, i)) & Chr(13)
		Next i
		MsgBox(str_Renamed)
	End Sub
	
	
	'UPGRADE_NOTE: size was upgraded to size_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
	Private Sub min_deck(ByVal player As Short, ByVal size_Renamed As Short)
		Dim deck_size As Object
		Dim hand_size As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object deck_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		deck_size = deck_count(player)
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		hand_size = hand_count(player)
		
		' draw cards and then put them back
		Call draw_cards(player, size_Renamed)
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		While (hand_count(player) > hand_size)
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call put_on_top_of_deck(player, hand(player, hand_count(player) - 1), 0)
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hand(player, hand_count(player) - 1) = -1
		End While
		refresh_lists()
	End Sub
	
	Private Sub pick_actions()
		Dim j, i, temp As Object
		Dim r As Short
		
		For i = 0 To 99
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			embargo(i) = 0
		Next i
		
		' set the pile sizes for gold, etc
		pile_size(0) = 60 - 7 * num_players
		pile_size(1) = 40
		pile_size(2) = 30
		pile_size(3) = victory_count
		pile_size(4) = victory_count
		pile_size(5) = victory_count
		pile_size(6) = 10 * (num_players - 1)
		
		' pick random actions
		Dim picked(100) As Short
		Randomize()
		
		' first pick any actions that the user specified
		Dim already_picked As Short
		Dim id As Short
		already_picked = 0
		For i = 0 To num_actions - 1
			If PickActions.lstActions(i).Text <> "Random" Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				id = get_id_by_name(Mid(PickActions.lstActions(i).Text, 5))
				'MsgBox Mid(PickActions.lstActions(i).Text, 5)
				If not_coded(id) <> 1 Then
					picked(id - 7) = 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					action_cards(i) = id
					already_picked = already_picked + 1
				Else
					MsgBox(names(id) & " has not been coded yet")
				End If
			End If
		Next i
		
		' now pick the rest randomly
		Dim valid, num As Object
		Dim alchemy_found As Short
		alchemy_found = -1
		For i = already_picked To num_actions - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If i = 8 And PickActions.chkAlchemy.CheckState = 1 Then
				For j = 0 To 7
					'MsgBox "Checking " & j & "against " & names(action_cards(j))
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If action_cards(j) >= 83 And action_cards(j) <= 95 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						alchemy_found = j
						'MsgBox "FOUND!"
					End If
				Next j
				If alchemy_found > -1 Then
					'MsgBox "Alchemy found! " & names(action_cards(alchemy_found))
					PickActions.chkSetA.CheckState = System.Windows.Forms.CheckState.Checked
					PickActions.chkSetB.CheckState = System.Windows.Forms.CheckState.Unchecked
					PickActions.chkSetS.CheckState = System.Windows.Forms.CheckState.Unchecked
					PickActions.chkSetI.CheckState = System.Windows.Forms.CheckState.Unchecked
				Else
					PickActions.chkSetA.CheckState = System.Windows.Forms.CheckState.Unchecked
				End If
			End If
			
			
			'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			valid = 0
			'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			While (valid = 0)
				'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				valid = 1
				r = Int(num_all_actions * Rnd())
				
				For j = 0 To num_all_actions - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object num. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					num = j
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Potion). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object num. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object num. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If num > get_id_by_name("Potion") Then num = num - 1
					If PickActions.chkCard(num).CheckState = 0 And names(r + 7) = Mid(PickActions.chkCard(num).Text, 5) Then
						'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						valid = 0
					End If
				Next j
				
				If picked(r) = 1 Or not_coded(r + 7) = 1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					valid = 0
				ElseIf PickActions.chkSetB.CheckState = 0 And r < 25 Then 
					'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					valid = 0
				ElseIf PickActions.chkSetS.CheckState = 0 And r >= 25 And r < 51 Then 
					'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					valid = 0
				ElseIf PickActions.chkSetI.CheckState = 0 And r > 50 And r < 76 Then 
					'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					valid = 0
				ElseIf PickActions.chkSetA.CheckState = 0 And r > 75 Then 
					'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					valid = 0
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Potion). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				ElseIf r + 7 = get_id_by_name("Potion") Then 
					'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					valid = 0
				End If
			End While
			'If alchemy_found > 0 And i > 7 Then MsgBox "picked " & names(r + 7)
			picked(r) = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			action_cards(i) = r + 7
		Next i
		
		For i = 0 To num_actions - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			pile_size(action_cards(i)) = action_count
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If victory_points(action_cards(i)) > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				pile_size(action_cards(i)) = victory_count
			End If
		Next i
		
		' sort the actions by cost
		For i = 0 To num_actions - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For j = 0 To i - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If costs(action_cards(j)) > costs(action_cards(i)) Then
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object temp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					temp = action_cards(j)
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					action_cards(j) = action_cards(i)
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object temp. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					action_cards(i) = temp
				End If
			Next j
		Next i
		
		'action_cards(7) = get_id_by_name("Pirate Ship")
		'pile_size(get_id_by_name("Pirate Ship")) = 10
		
		' set the ids for each pile
		For i = 0 To 6
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			id_by_pile(i) = i
		Next i
		For i = 7 To 6 + num_actions
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			id_by_pile(i) = action_cards(i - 7)
		Next i
		
		Dim img As String
		For i = 0 To 18
			hide_supply_card((i))
			
			' load the images
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If victory_points(id_by_pile(i)) > 0 And gold(id_by_pile(i)) > 0 Then
				img = "TreasureVictory"
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf victory_points(id_by_pile(i)) > 0 And is_action(id_by_pile(i)) > 0 Then 
				img = "ActionVictory"
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf victory_points(id_by_pile(i)) > 0 Then 
				img = "Victory"
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf gold(id_by_pile(i)) > 0 Then 
				img = "Treasure"
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf is_duration(id_by_pile(i)) > 0 Then 
				img = "Duration"
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf victory_points(id_by_pile(i)) = -1 Then 
				img = "Curse"
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf is_reaction(id_by_pile(i)) > 0 Then 
				img = "Reaction"
			Else
				img = "Action"
			End If
			imgSupply(i).Image = System.Drawing.Image.FromFile(My.Application.Info.DirectoryPath & "/images/" & img & "_supply.jpg")
		Next i
		For i = 6 + num_actions To 19
			hide_supply_card((i))
		Next i
		
		' if native village was picked, show that prompt
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		pile_size(get_id_by_name("Potion")) = 0
		For i = 0 To num_actions - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If names(action_cards(i)) = "Native Village" Or Campaign.scenario_selected = 8 Then
				lblVillage.Visible = True
				lblVillageCards.Visible = True
			End If
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If names(action_cards(i)) = "Pirate Ship" Then
				lblCoinTokens.Visible = True
				lblCoinTokenText.Visible = True
			End If
			
			' if any cards requiring potions were picked, show potions
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Potion). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If action_cards(i) >= 83 And action_cards(i) <= 95 And id_by_pile(num_actions + 6) <> get_id_by_name("Potion") Then
				num_actions = num_actions + 1
				show_supply_card((num_actions + 6))
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				id_by_pile(num_actions + 6) = get_id_by_name("Potion")
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				action_cards(num_actions - 1) = get_id_by_name("Potion")
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				pile_size(get_id_by_name("Potion")) = 16
				imgSupply(num_actions + 6).Image = System.Drawing.Image.FromFile(My.Application.Info.DirectoryPath & "/images/treasure_supply.jpg")
				Call imgSupply(num_actions + 6).SetBounds(imgSupply(19).Left, imgSupply(19).Top, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
				Call lblSupplyLeft(num_actions + 6).SetBounds(lblSupplyLeft(19).Left, lblSupplyLeft(19).Top, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
				Call lblSupplyTitle(num_actions + 6).SetBounds(lblSupplyTitle(19).Left, lblSupplyTitle(19).Top, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
				Call lblSupplyCost(num_actions + 6).SetBounds(lblSupplyCost(19).Left, lblSupplyCost(19).Top, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			End If
		Next i
		
		' reload action settings from file
		Call PickActions.PickActions_Load(Nothing, New System.EventArgs())
		
	End Sub
	
	Private Sub update_button_text()
		Dim i, j As Object
		Dim id As Short
		' label the cards for gold, etc
		For i = 0 To 6 + num_actions
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			id = id_by_pile(i)
			lblSupplyTitle(i).Text = names(id)
			For j = 0 To embargo(id) - 1
				lblSupplyTitle(i).Text = lblSupplyTitle(i).Text & "*"
			Next j
			lblSupplyCost(i).Text = CStr(costs(id))
			If potions(id) > 0 Then
				lblSupplyCost(i).Text = lblSupplyCost(i).Text & "+"
			End If
			lblSupplyLeft(i).Text = CStr(pile_size(id))
			If pile_size(id) = 0 Then
				lblSupplyTitle(i).ForeColor = System.Drawing.Color.Red
			Else
				lblSupplyTitle(i).ForeColor = System.Drawing.Color.Black
			End If
		Next i
	End Sub
	Private Function hand_count(ByVal player As Short) As Object
		Dim i As Short
		i = 0
		While (hand(player, i) > -1)
			'       MsgBox ("checking hand " & i & " and it is " & hand(player, i))
			i = i + 1
		End While
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		hand_count = i
	End Function
	
	Private Function duration_count(ByVal player As Short) As Object
		Dim i As Short
		i = 0
		While (durations_played(player, i) > -1)
			'        MsgBox ("checking hand " & i & " and it is " & hand(player, i))
			i = i + 1
		End While
		'UPGRADE_WARNING: Couldn't resolve default property of object duration_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		duration_count = i
	End Function
	
	Private Function deck_count(ByVal player As Short) As Object
		Dim i As Short
		i = 0
		While (deck(player, i) > -1)
			i = i + 1
		End While
		'UPGRADE_WARNING: Couldn't resolve default property of object deck_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		deck_count = i
	End Function
	
	Private Function limbo_count(ByVal player As Short) As Object
		Dim i As Short
		i = 0
		While (limbo(player, i) > -1)
			i = i + 1
		End While
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		limbo_count = i
	End Function
	
	Private Function village_count(ByVal player As Short) As Object
		Dim i As Short
		i = 0
		While (native_village(player, i) > -1)
			i = i + 1
		End While
		'UPGRADE_WARNING: Couldn't resolve default property of object village_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		village_count = i
	End Function
	
	Private Function discard_count(ByVal player As Short) As Object
		Dim i As Short
		i = 0
		While (discard(player, i) > -1)
			i = i + 1
		End While
		'UPGRADE_WARNING: Couldn't resolve default property of object discard_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		discard_count = i
	End Function
	
	Private Function gained_count(ByVal player As Short) As Object
		Dim i As Short
		i = 0
		While (gained(player, i) > -1)
			i = i + 1
		End While
		'UPGRADE_WARNING: Couldn't resolve default property of object gained_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		gained_count = i
	End Function
	
	Private Function haven_count(ByVal player As Short) As Object
		Dim i As Short
		i = 0
		While (haven(player, i) > -1)
			i = i + 1
		End While
		'UPGRADE_WARNING: Couldn't resolve default property of object haven_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		haven_count = i
	End Function
	
	Private Function island_count(ByVal player As Short) As Object
		Dim i As Short
		i = 0
		While (island(player, i) > -1)
			i = i + 1
		End While
		'UPGRADE_WARNING: Couldn't resolve default property of object island_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		island_count = i
	End Function
	
	
	Private Function draw_cards(ByVal player As Short, ByRef num As Short) As Object
		Dim j, i, deck_size As Object
		Dim hand_size As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object draw_cards. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		draw_cards = 1
		For i = 1 To num
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If deck_count(player) = 0 Then
				'MsgBox "shuffling deck (discard size = " & discard_count(player)
				shuffle_deck((player))
			End If
			
			' if deck is still empty then do not draw
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck_size = deck_count(player)
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If deck_size = 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object draw_cards. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				draw_cards = 0
			Else
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				hand_size = hand_count(player)
				hand(player, hand_size) = deck(player, 0)
				hand(player, hand_size + 1) = -1
				'UPGRADE_WARNING: Couldn't resolve default property of object deck_size. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For j = 0 To deck_size
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					deck(player, j) = deck(player, j + 1)
				Next j
			End If
		Next i
		
		Call refresh_lists()
		
	End Function
	
	Private Sub add_ai_play(ByVal Index As Short, ByVal indent As Short)
		Dim i As Short
		If imgWhite.Visible = False Then
			lblPrompt2.Visible = True
			lblPrompt2.Text = player_names(active_player) & " Action Phase:      "
			imgWhite.Visible = True
			For i = 0 To 6 + num_actions
				hide_supply_card((i))
			Next i
		End If
		For i = 0 To 100
			If imgOpponentPlayed(i).Visible = False Then
				imgOpponentPlayed(i).Visible = True
				imgOpponentPlayed(i).Tag = Index
				imgOpponentPlayed(i).Image = images(Index)
				If indent = 1 Then
					Call imgOpponentPlayed(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentPlayed(i).Left) + 200), imgOpponentPlayed(i).Top, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
				ElseIf indent = 2 Then 
					Call imgOpponentPlayed(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentPlayed(i).Left) - 200), imgOpponentPlayed(i).Top, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
				End If
				i = 100
			End If
		Next i
	End Sub
	
	Private Sub add_ai_buy(ByVal Index As Short, ByVal indent As Short)
		Dim i As Short
		lblPrompt2.Text = player_names(active_player) & " Action Phase:                        Buy Phase: "
		If imgWhite.Visible = False Then
			lblPrompt2.Visible = True
			imgWhite.Visible = True
			For i = 0 To 6 + num_actions
				hide_supply_card((i))
			Next i
		End If
		For i = 0 To 100
			If Index > -1 Then
				If imgOpponentBought(i).Visible = False Then
					imgOpponentBought(i).Visible = True
					imgOpponentBought(i).Tag = Index
					imgOpponentBought(i).Image = images(Index)
					If indent = 1 Then
						Call imgOpponentBought(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentBought(i).Left) + 200), imgOpponentBought(i).Top, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
					End If
					i = 100
				End If
			End If
		Next i
		cmdContinue.Visible = True
	End Sub
	
	Private Sub add_choice(ByVal Index As Short)
		Dim i As Short
		If imgWhite.Visible = False Then
			lblPrompt2.Visible = True
			imgWhite.Visible = True
			For i = 0 To 6 + num_actions
				hide_supply_card((i))
			Next i
		End If
		For i = 0 To 100
			If imgChoice(i).Visible = False Then
				imgChoice(i).Visible = True
				imgChoice(i).Tag = Index
				imgChoice(i).Image = images(Index)
				i = 100
			End If
		Next i
	End Sub
	
	Private Sub hide_choices()
		Dim i As Short
		imgWhite.Visible = False
		lblPrompt2.Visible = False
		For i = 0 To 40
			imgChoice(i).Visible = False
		Next i
		For i = 0 To 40
			imgOpponentBought(i).Visible = False
		Next i
		For i = 0 To imgOpponentPlayed.UBound
			imgOpponentPlayed(i).Visible = False
		Next i
		For i = 0 To 6 + num_actions
			show_supply_card((i))
		Next i
		cmdContinue.Visible = False
		
		
		' move these images back to their original spots
		imgOpponentPlayed(0).SetBounds(VB6.TwipsToPixelsX(3600), VB6.TwipsToPixelsY(480), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
		imgOpponentBought(0).SetBounds(VB6.TwipsToPixelsX(7320), VB6.TwipsToPixelsY(480), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
		For i = 0 To 40
			imgOpponentPlayed(i).SetBounds(imgOpponentPlayed(0).Left, VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentPlayed(0).Top) + 400 * i), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			If i > 3 Then
				imgOpponentPlayed(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentPlayed(0).Left) + 2000), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentPlayed(0).Top) + 400 * (i - 4)), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			End If
			imgOpponentBought(i).SetBounds(imgOpponentBought(0).Left, VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentBought(0).Top) + 400 * i), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			If i > 3 Then
				imgOpponentBought(i).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(imgOpponentBought(0).Left) + 2000), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(imgOpponentBought(0).Top) + 400 * (i - 4)), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
			End If
		Next i
		
	End Sub
	
	Private Sub refresh_lists()
		Dim i As Short
		' update the list to match our hand
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To hand_count(0) - 1
			imgHand(i).Visible = True
			If imgHand(i).Tag <> Str(hand(0, i)) Then
				imgHand(i).Image = images(hand(0, i))
				imgHand(i).Tag = Str(hand(0, i))
			End If
		Next i
		'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = hand_count(0) To imgHand.UBound
			imgHand(i).Visible = False
		Next i
		' update the deck
		lstDeck.Items.Clear()
		'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To deck_count(0) - 1
			lstDeck.Items.Add(names(deck(0, i)))
		Next i
		
		'update limbo
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = 0 To limbo_count(0) - 1
			imgLimbo(i).Visible = True
			If imgLimbo(i).Tag <> Str(limbo(0, i)) Then
				imgLimbo(i).Image = images(limbo(0, i))
				imgLimbo(i).Tag = Str(limbo(0, i))
			End If
		Next i
		'UPGRADE_WARNING: Couldn't resolve default property of object limbo_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		For i = limbo_count(0) To imgLimbo.UBound
			imgLimbo(i).Visible = False
		Next i
		
		' update hand/discard status for all players
		For i = 0 To num_players - 1
			lblOpponent(i).Text = player_names(i)
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			lblHands(i).Text = hand_count(i)
			'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			lblDiscard(i).Text = discard_count(i)
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			lblDeck(i).Text = deck_count(i)
			lblOpponent(i).ForeColor = System.Drawing.Color.White
			lblHands(i).ForeColor = System.Drawing.Color.White
			lblDiscard(i).ForeColor = System.Drawing.Color.White
			lblDeck(i).ForeColor = System.Drawing.Color.White
		Next i
		lblOpponent(active_player).ForeColor = System.Drawing.Color.Yellow
		lblHands(active_player).ForeColor = System.Drawing.Color.Yellow
		lblDiscard(active_player).ForeColor = System.Drawing.Color.Yellow
		lblDeck(active_player).ForeColor = System.Drawing.Color.Yellow
		
	End Sub
	Private Sub shuffle_deck(ByRef player As Short)
		'UPGRADE_WARNING: Couldn't resolve default property of object discard_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If player = 0 And discard_count(0) > 0 Then
			Call play_sound("shuffle_cards.wav")
		End If
		
		' put discard pile into deck
		Dim i, r As Object
		Dim deck_size As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		deck_size = deck_count(player)
		
		'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		i = 0
		'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		While (discard(player, i) > -1)
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck(player, deck_size + i) = discard(player, i)
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			i = i + 1
		End While
		discard(player, 0) = -1
		
		' shuffle
		'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		deck_size = deck_size + i
		deck(player, deck_size) = -1
		Dim new_deck(100) As Short
		Dim picked(100) As Short
		Randomize()
		For i = 0 To deck_size - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object r. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			r = Int(deck_size * Rnd())
			'UPGRADE_WARNING: Couldn't resolve default property of object r. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			While (picked(r) = 1)
				'UPGRADE_WARNING: Couldn't resolve default property of object r. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				r = Int(deck_size * Rnd())
				
			End While
			'UPGRADE_WARNING: Couldn't resolve default property of object r. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			picked(r) = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object r. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			new_deck(r) = deck(player, i)
		Next i
		
		For i = 0 To deck_size - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck(player, i) = new_deck(i)
		Next i
		deck(player, deck_size) = -1
	End Sub
	
	Private Sub load_picture(ByRef Index As Short)
		imgDetails.Image = images(Index)
	End Sub
	
	
	Private Function get_game_progress() As Object
		If CDbl(lblTurn.Text) < 6 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object get_game_progress. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			get_game_progress = 1
			Exit Function
		End If
		
		' if a scenario ended, then end now
		If Campaign.scenario_selected > 0 Then
			If scenario_end_game <> 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_game_progress. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				get_game_progress = 0
				Exit Function
			End If
		End If
		
		' add up the size of the 4 smallest piles
		Dim j, i, found As Object
		Dim total As Short
		total = 0
		For i = 0 To 20
			For j = 0 To 6 + num_actions
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If pile_size(id_by_pile(j)) = i Then
					'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					found = found + 1
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					total = total + pile_size(id_by_pile(j))
					'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If found = num_piles_to_exhaust Then
						lblProgress.Text = CStr(total / (10 * num_piles_to_exhaust))
						
						' check to see if provinces are about to run out
						If pile_size(5) / victory_count < CDbl(lblProgress.Text) Then
							lblProgress.Text = CStr(pile_size(5) / victory_count)
						End If
						'UPGRADE_WARNING: Couldn't resolve default property of object get_game_progress. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						get_game_progress = lblProgress.Text
						Exit Function
					End If
				End If
			Next j
		Next i
	End Function
	
	Private Sub imgSupply_MouseMove(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles imgSupply.MouseMove
		Dim Button As Short = eventArgs.Button \ &H100000
		Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
		Dim X As Single = VB6.PixelsToTwipsX(eventArgs.X)
		Dim Y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
		Dim Index As Short = imgSupply.GetIndex(eventSender)
		With imgSupply(Index)
			If (X < 0) Or (Y < 0) Or (X > VB6.PixelsToTwipsX(.Width)) Or (Y > VB6.PixelsToTwipsY(.Height)) Then
				' do nothing
			Else
				load_picture((id_by_pile(Index)))
			End If
		End With
	End Sub
	
	Private Sub lblSupplyTitle_MouseMove(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles lblSupplyTitle.MouseMove
		Dim Button As Short = eventArgs.Button \ &H100000
		Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
		Dim X As Single = VB6.PixelsToTwipsX(eventArgs.X)
		Dim Y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
		Dim Index As Short = lblSupplyTitle.GetIndex(eventSender)
		With lblSupplyTitle(Index)
			If (X < 0) Or (Y < 0) Or (X > VB6.PixelsToTwipsX(.Width)) Or (Y > VB6.PixelsToTwipsY(.Height)) Then
				' do nothing
			Else
				load_picture((id_by_pile(Index)))
			End If
		End With
	End Sub
	
	Private Sub resume_actions()
		phase = "action"
		Call play_game()
	End Sub
	
	Private Sub imgLimbo_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles imgLimbo.Click
		Dim Index As Short = imgLimbo.GetIndex(eventSender)
		Dim card As Short
		card = limbo(0, Index)
		If phase = "herbalist" And gold(card) > 0 Then
			Call put_on_top_of_deck(active_player, limbo(active_player, Index), 0)
			Call remove_card_from_limbo(active_player, Index)
			imgNext.Tag = CDbl(imgNext.Tag) - 1
			If CDbl(imgNext.Tag) = 0 Then
				Call cleanup()
			End If
		End If
	End Sub
	
	Private Sub imgHand_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles imgHand.Click
		Dim Index As Short = imgHand.GetIndex(eventSender)
		'MsgBox "phase = " & phase & " and throne count = " & throne_copies & " and done = " & throne_original_played
		Dim i, card, j As Object
		Dim intResult As Short
		Dim id As Short
		If phase = "action" And can_play_actions(0) And can_play_action(0, hand(0, Index)) Then
			If CDbl(lblTurn.Text) < 16 Then did_anything = 1
			'MsgBox "going to play card"
			play_action((hand(0, Index)))
		ElseIf phase = "ambassador" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			card = hand(0, Index)
			
			'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			intResult = MsgBox("Would you like to return a copy of " & names(card) & "?", MsgBoxStyle.YesNo)
			If intResult = MsgBoxResult.Yes Then
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call remove_card_from_hand(0, find_card(0, card))
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				pile_size(card) = pile_size(card) + 1
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object find_card(0, card). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If find_card(0, card) > -1 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					intResult = MsgBox("Would you like to return another copy of " & names(card) & "?", MsgBoxStyle.YesNo)
					If intResult = MsgBoxResult.Yes Then
						'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object find_card(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						Call remove_card_from_hand(0, find_card(0, card))
						'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						pile_size(card) = pile_size(card) + 1
					End If
				End If
				
			End If
			
			For i = 1 To num_players - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object protected_Renamed(i). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If protected_Renamed(i) = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call gain_card(i, card)
				End If
			Next i
			Call resume_actions()
		ElseIf phase = "bureaucrat" And victory_points(hand(0, Index)) > 0 Then 
			Call put_on_top_of_deck(0, hand(0, Index), 1)
			Call remove_card_from_hand(0, Index)
			Call hide_prompt()
			Call resume_actions()
		ElseIf phase = "cellar" Then 
			Call discard_card(0, Index)
			imgNext.Tag = Val(imgNext.Tag) + 1
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If hand_count(0) = 0 Then
				Call imgNext_Click(imgNext, New System.EventArgs())
			End If
		ElseIf phase = "chapel" Then 
			Call trash_card_from_hand(0, Index)
			imgNext.Tag = CDbl(imgNext.Tag) + 1
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If hand_count(0) = 0 Or CDbl(imgNext.Tag) = 4 Then
				Call imgNext_Click(imgNext, New System.EventArgs())
			End If
		ElseIf phase = "courtyard" Then 
			Call put_on_top_of_deck(0, hand(0, Index), 1)
			Call remove_card_from_hand(0, Index)
			Call resume_actions()
		ElseIf phase = "ghost_ship" Then 
			Call put_on_top_of_deck(0, hand(0, Index), 1)
			Call remove_card_from_hand(0, Index)
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If hand_count(0) <= 3 Then
				Call hide_prompt()
				Call imgNext_Click(imgNext, New System.EventArgs())
			End If
		ElseIf phase = "haven" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object haven_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			haven(0, haven_count(0) + 1) = -1
			'UPGRADE_WARNING: Couldn't resolve default property of object haven_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			haven(0, haven_count(0)) = hand(0, Index)
			Call remove_card_from_hand(0, Index)
			Call resume_actions()
		ElseIf phase = "island" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object island_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			island(0, island_count(0) + 1) = -1
			'UPGRADE_WARNING: Couldn't resolve default property of object island_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			island(0, island_count(0)) = hand(0, Index)
			Call remove_card_from_hand(0, Index)
			Call resume_actions()
		ElseIf phase = "masquerade" Then 
			For i = num_players - 1 To 1 Step -1
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				j = (i + 1) Mod num_players
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object find_best_card_to_trash(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				card = find_best_card_to_trash(i)
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call add_card_to_hand(j, hand(i, card))
				'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call remove_card_from_hand(i, card)
			Next i
			Call add_card_to_hand(1, hand(0, Index))
			Call remove_card_from_hand(0, Index)
			lblPrompt.Text = "Choose a card to trash"
			Call show_next("Done Trashing")
			phase = "masquerade_trash"
		ElseIf phase = "masquerade_trash" Then 
			Call trash_card_from_hand(0, Index)
			Call imgNext_Click(imgNext, New System.EventArgs())
		ElseIf phase = "militia" Then 
			Call discard_card(0, Index)
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If hand_count(0) <= 3 Then
				Call hide_prompt()
				Call imgNext_Click(imgNext, New System.EventArgs())
			End If
		ElseIf phase = "mine" And gold(hand(0, Index)) > 0 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			remodel_cost = costs(hand(0, Index)) + 3
			remodel_potions = potions(hand(0, Index))
			Call trash_card_from_hand(active_player, Index)
			phase = "mine2"
			'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			lblPrompt.Text = "Select a coin card costing up to " & remodel_cost & " to gain"
		ElseIf phase = "remodel" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			remodel_cost = costs(hand(0, Index)) + 2
			remodel_potions = potions(hand(0, Index))
			Call trash_card_from_hand(active_player, Index)
			phase = "remodel2"
			'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			lblPrompt.Text = "Select a card costing up to " & remodel_cost & " to gain"
		ElseIf phase = "apprentice" Then 
			Call draw_cards(active_player, costs(hand(0, Index)))
			If potions(hand(0, Index)) > 0 Then
				Call draw_cards(active_player, 2)
			End If
			Call trash_card_from_hand(active_player, Index)
			Call resume_actions()
		ElseIf phase = "salvager" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object coins. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			Call set_coins(0, coins + costs(hand(0, Index)))
			Call trash_card_from_hand(active_player, Index)
			Call resume_actions()
		ElseIf phase = "secret_chamber" Then 
			Call discard_card(0, Index)
			imgNext.Tag = CDbl(imgNext.Tag) + 1
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If hand_count(0) = 0 Then
				Call imgNext_Click(imgNext, New System.EventArgs())
			End If
		ElseIf phase = "secret_chamber_react" Then 
			Call put_on_top_of_deck(0, hand(0, Index), 0)
			Call remove_card_from_hand(0, Index)
			'UPGRADE_WARNING: Couldn't resolve default property of object secret_chamber_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			secret_chamber_count = secret_chamber_count - 1
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object secret_chamber_count. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If secret_chamber_count = 0 Or hand_count(0) = 0 Then
				Call hide_prompt()
				Call play_action(current_action)
				Call play_game()
			End If
		ElseIf phase = "steward" Then 
			Call trash_card_from_hand(active_player, Index)
			lblPrompt.Tag = CDbl(lblPrompt.Tag) + 1
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If CDbl(lblPrompt.Tag) = 2 Or hand_count(0) = 0 Then
				Call imgNext_Click(imgNext, New System.EventArgs())
			End If
		ElseIf phase = "transmute" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			card = hand(active_player, Index)
			Call trash_card_from_hand(active_player, Index)
			'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If is_action(card) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card(active_player, get_id_by_name("Duchy"))
			End If
			'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If gold(card) > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card(active_player, get_id_by_name("Transmute"))
			End If
			'UPGRADE_WARNING: Couldn't resolve default property of object card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If victory_points(card) > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card(active_player, get_id_by_name("Gold"))
			End If
			Call resume_actions()
			
		ElseIf phase = "throne_room" And can_play_action(0, hand(0, Index)) Then 
			phase = "action"
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_card. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			throne_card = hand(0, Index)
			'UPGRADE_WARNING: Couldn't resolve default property of object throne_copies. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			throne_copies = throne_copies + 1
			throne_original_played = 0
			Call move_played_card(Index)
			Call play_game() ' the copy will get played here
		ElseIf phase = "torturer" Then 
			Call discard_card(0, Index)
			lblPrompt.Tag = CDbl(lblPrompt.Tag) + 1
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If hand_count(0) = 0 Or CDbl(lblPrompt.Tag) = 2 Then
				Call hide_prompt()
				play_card_specific_action((get_id_by_name("Torturer")))
				Call play_game()
			End If
		ElseIf phase = "trading_post" Then 
			Call trash_card_from_hand(active_player, Index)
			lblPrompt.Tag = CDbl(lblPrompt.Tag) + 1
			If CDbl(lblPrompt.Tag) = 2 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				Call gain_card_to_hand(0, get_id_by_name("Silver"))
			End If
			
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If hand_count(0) = 0 Or CDbl(lblPrompt.Tag) = 2 Then
				Call resume_actions()
			End If
		ElseIf phase = "upgrade" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			remodel_cost = costs(hand(0, Index)) + 1
			remodel_potions = potions(hand(0, Index))
			Call trash_card_from_hand(active_player, Index)
			
			' make sure there is a card to gain
			For i = 0 To num_actions + 6
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				id = id_by_pile(i)
				'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If costs(id) = remodel_cost And potions(id) = remodel_potions And pile_size(id) > 0 Then
					phase = "upgrade2"
					'UPGRADE_WARNING: Couldn't resolve default property of object remodel_cost. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					lblPrompt.Text = "Select a costing exactly " & remodel_cost & " to gain"
					Exit Sub
				End If
			Next i
			
			Call resume_actions()
		ElseIf phase = "university" Then 
			Call resume_actions()
		ElseIf phase = "warehouse" Then 
			Call discard_card(0, Index)
			discard_counter = discard_counter + 1
			'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If discard_counter = 3 Or hand_count(0) = 0 Then
				discard_counter = 0
				Call resume_actions()
			End If
		End If
	End Sub
	
	Private Sub imgHand_MouseMove(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles imgHand.MouseMove
		Dim Button As Short = eventArgs.Button \ &H100000
		Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
		Dim X As Single = VB6.PixelsToTwipsX(eventArgs.X)
		Dim Y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
		Dim Index As Short = imgHand.GetIndex(eventSender)
		With imgHand(Index)
			If (X < 0) Or (Y < 0) Or (X > VB6.PixelsToTwipsX(.Width)) Or (Y > VB6.PixelsToTwipsY(.Height)) Then
				' do nothing
			Else
				load_picture((hand(0, Index)))
			End If
		End With
	End Sub
	
	Private Sub imgLimbo_MouseMove(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles imgLimbo.MouseMove
		Dim Button As Short = eventArgs.Button \ &H100000
		Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
		Dim X As Single = VB6.PixelsToTwipsX(eventArgs.X)
		Dim Y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
		Dim Index As Short = imgLimbo.GetIndex(eventSender)
		With imgLimbo(Index)
			If (X < 0) Or (Y < 0) Or (X > VB6.PixelsToTwipsX(.Width)) Or (Y > VB6.PixelsToTwipsY(.Height)) Then
				' do nothing
			Else
				load_picture((limbo(0, Index)))
			End If
		End With
	End Sub
	
	Private Sub imgChoice_MouseMove(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles imgChoice.MouseMove
		Dim Button As Short = eventArgs.Button \ &H100000
		Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
		Dim X As Single = VB6.PixelsToTwipsX(eventArgs.X)
		Dim Y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
		Dim Index As Short = imgChoice.GetIndex(eventSender)
		With imgChoice(Index)
			If (X < 0) Or (Y < 0) Or (X > VB6.PixelsToTwipsX(.Width)) Or (Y > VB6.PixelsToTwipsY(.Height)) Then
				' do nothing
			Else
				load_picture(CShort(imgChoice(Index).Tag))
			End If
		End With
	End Sub
	
	Private Sub imgOpponentPlayed_MouseMove(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles imgOpponentPlayed.MouseMove
		Dim Button As Short = eventArgs.Button \ &H100000
		Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
		Dim X As Single = VB6.PixelsToTwipsX(eventArgs.X)
		Dim Y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
		Dim Index As Short = imgOpponentPlayed.GetIndex(eventSender)
		With imgOpponentPlayed(Index)
			If (X < 0) Or (Y < 0) Or (X > VB6.PixelsToTwipsX(.Width)) Or (Y > VB6.PixelsToTwipsY(.Height)) Then
				' do nothing
			Else
				load_picture(CShort(imgOpponentPlayed(Index).Tag))
			End If
		End With
	End Sub
	
	Private Sub imgOpponentBought_MouseMove(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.MouseEventArgs) Handles imgOpponentBought.MouseMove
		Dim Button As Short = eventArgs.Button \ &H100000
		Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
		Dim X As Single = VB6.PixelsToTwipsX(eventArgs.X)
		Dim Y As Single = VB6.PixelsToTwipsY(eventArgs.Y)
		Dim Index As Short = imgOpponentBought.GetIndex(eventSender)
		With imgOpponentBought(Index)
			If (X < 0) Or (Y < 0) Or (X > VB6.PixelsToTwipsX(.Width)) Or (Y > VB6.PixelsToTwipsY(.Height)) Then
				' do nothing
			Else
				load_picture(CShort(imgOpponentBought(Index).Tag))
			End If
		End With
	End Sub
	
	Private Sub lblRules_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lblRules.Click
		ShellExecute(Me.Handle.ToInt32, "open", "http://www.riograndegames.com/uploads/Game/Game_278_gameRules.pdf", vbNullString, "", 0)
	End Sub
	
	Private Sub imgChoice_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles imgChoice.Click
		Dim Index As Short = imgChoice.GetIndex(eventSender)
		Dim card As Short
		card = CShort(imgChoice(Index).Tag)
		Dim count As Short
		Dim found As Object
		Dim i As Short
		If phase = "smugglers" And costs(card) < 7 And pile_size(card) > 0 And potions(card) = 0 Then
			Call gain_card(0, card)
			phase = "action"
			Call hide_choices()
			Call play_game()
		ElseIf phase = "navigator" Or phase = "scout" Then 
			imgChoice(Index).Visible = False
			Call put_on_top_of_deck(0, card, 0)
			'UPGRADE_WARNING: Couldn't resolve default property of object found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			found = 0
			If choices_found = 0 Then
				phase = "action"
				Call hide_choices()
				Call play_game()
			End If
		ElseIf phase = "envoy" Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object deck_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			count = deck_count(active_player)
			If count > 5 Then count = 5
			For i = 0 To count - 1
				Call draw_cards(active_player, 1)
				If i = Index Then
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					Call discard_card(active_player, hand_count(active_player) - 1)
				End If
			Next i
			phase = "action"
			Call hide_choices()
			For i = 0 To CDbl(imgWhite.Tag) + 1
				Call add_ai_play(CShort(imgOpponentBought(i).Tag), 0)
			Next i
			
			Call play_game()
		ElseIf phase = "lookout" Then 
			imgChoice(Index).Visible = False
			If choices_found = 0 Then
				phase = "action"
				Call hide_choices()
				Call play_game()
			Else
				lblPrompt2.Text = "Choose a card to discard"
				phase = "lookout2"
			End If
		ElseIf phase = "lookout2" Then 
			imgChoice(Index).Visible = False
			Call add_card_to_discard(0, card)
			If choices_found > 0 Then
				For i = 0 To 2
					If imgChoice(i).Visible = True Then
						Call put_on_top_of_deck(0, CShort(imgChoice(i).Tag), 1)
					End If
				Next i
			End If
			phase = "action"
			Call hide_choices()
			Call play_game()
		End If
	End Sub
	
	Private Function choices_found() As Object
		Dim i As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object choices_found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		choices_found = 0
		For i = 0 To 4
			If imgChoice(i).Visible = True Then
				'UPGRADE_WARNING: Couldn't resolve default property of object choices_found. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				choices_found = 1
			End If
		Next i
	End Function
	
	Private Sub show_supply_card(ByVal i As Short)
		If hidden(i) <> 1 Then
			imgSupply(i).Visible = True
			lblSupplyTitle(i).Visible = True
			lblSupplyCost(i).Visible = True
			lblSupplyLeft(i).Visible = True
		End If
	End Sub
	Private Sub hide_supply_card(ByVal i As Short)
		'MsgBox "Hiding " & names(id_by_pile(i)) & "which is " & i
		imgSupply(i).Visible = False
		lblSupplyTitle(i).Visible = False
		lblSupplyCost(i).Visible = False
		lblSupplyLeft(i).Visible = False
	End Sub
	
	
	Private Sub lblWebsite_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles lblWebsite.Click
		ShellExecute(Me.Handle.ToInt32, "open", "http://www.riograndegames.com/games.html?id=278", vbNullString, "", 0)
	End Sub
	
	Private Sub hide_prompt()
		lblPrompt.Visible = False
		imgPrompt.Visible = False
	End Sub
	
	'UPGRADE_NOTE: str was upgraded to str_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
	Private Sub show_prompt(ByVal str_Renamed As String)
		lblPrompt.Visible = True
		lblPrompt.Text = str_Renamed
		imgPrompt.Visible = True
	End Sub
	
	Private Sub scenario_start_game()
		
		Dim i As Object
		Dim j As Short
		For i = 0 To num_actions + 6
			'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hidden(i) = 0
		Next i
		
		'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		never_buy(get_id_by_name("Province")) = 0
		If Campaign.scenario_selected > 0 Then
			num_piles_to_exhaust = 3
			For i = 0 To num_all_actions - 7
				PickActions.chkCard(i).CheckState = System.Windows.Forms.CheckState.Checked
			Next i
			
			If Campaign.scenario_selected < 10 Then
				For i = 0 To 11
					PickActions.lstActions(i).Text = "Random"
				Next i
			End If
			
		End If
		
		If Campaign.scenario_selected = 1 Then
			num_actions = 4
			num_players = 2
			victory_count = 2
			deck(0, 0) = -1
			hand(0, 0) = -1
			
			num_actions = 4
			PickActions.lstActions(0).Text = "(B) Market"
			PickActions.lstActions(1).Text = "(B) Militia"
			PickActions.lstActions(2).Text = "(B) Village"
			PickActions.lstActions(3).Text = "(B) Smithy"
		ElseIf Campaign.scenario_selected = 2 Then 
			num_players = 4
			victory_count = 8
			
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck(0, 0) = get_id_by_name("Gold")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck(0, 1) = get_id_by_name("Copper")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck(0, 2) = get_id_by_name("Copper")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck(0, 3) = get_id_by_name("Gold")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			deck(0, 4) = get_id_by_name("Silver")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hand(0, 0) = get_id_by_name("Copper")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hand(0, 1) = get_id_by_name("Copper")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hand(0, 2) = get_id_by_name("Copper")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hand(0, 3) = get_id_by_name("Copper")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hand(0, 4) = get_id_by_name("Copper")
			
			num_actions = 5
			PickActions.lstActions(0).Text = "(B) Woodcutter"
			PickActions.lstActions(1).Text = "(B) Thief"
			PickActions.lstActions(2).Text = "(B) Workshop"
			PickActions.lstActions(3).Text = "(B) Adventurer"
			PickActions.lstActions(4).Text = "(B) Village"
			
		ElseIf Campaign.scenario_selected = 3 Then 
			num_players = 4
			num_actions = 10
			victory_count = 8
			PickActions.chkSetB.CheckState = System.Windows.Forms.CheckState.Checked
			PickActions.chkSetS.CheckState = System.Windows.Forms.CheckState.Unchecked
			PickActions.chkSetI.CheckState = System.Windows.Forms.CheckState.Unchecked
			PickActions.chkSetA.CheckState = System.Windows.Forms.CheckState.Unchecked
			For i = 1 To 3
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				player_names(i) = "Sir " & player_names(i)
			Next i
			
		ElseIf Campaign.scenario_selected = 4 Then 
			num_players = 2
			num_actions = 10
			victory_count = 8
			PickActions.chkSetB.CheckState = System.Windows.Forms.CheckState.Checked
			PickActions.chkSetS.CheckState = System.Windows.Forms.CheckState.Unchecked
			PickActions.chkSetI.CheckState = System.Windows.Forms.CheckState.Unchecked
			PickActions.chkSetA.CheckState = System.Windows.Forms.CheckState.Unchecked
			player_names(1) = "Duke Egnor"
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			island(1, 0) = get_id_by_name("Duchy")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			island(1, 1) = get_id_by_name("Duchy")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			island(1, 2) = get_id_by_name("Duchy")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			island(1, 3) = get_id_by_name("Duchy")
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			island(1, 4) = get_id_by_name("Duke")
			island(1, 5) = -1
			
		ElseIf Campaign.scenario_selected = 5 Then 
			num_players = 4
			victory_count = 8
			
			num_actions = 8
			PickActions.lstActions(0).Text = "(S) Ghost Ship"
			PickActions.lstActions(1).Text = "(S) Merchant Ship"
			PickActions.lstActions(2).Text = "(S) Pirate Ship"
			PickActions.lstActions(3).Text = "(S) Lighthouse"
			PickActions.lstActions(4).Text = "(S) Warehouse"
			PickActions.lstActions(5).Text = "(S) Treasure Map"
			PickActions.lstActions(6).Text = "(S) Explorer"
			PickActions.lstActions(7).Text = "(S) Wharf"
			
		ElseIf Campaign.scenario_selected = 6 Then 
			num_players = 5
			victory_count = 12
			For i = 1 To 4
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				deck(i, 1) = get_id_by_name("Pirate Ship")
			Next i
			
			num_actions = 10
			PickActions.lstActions(0).Text = "(S) Navigator"
			PickActions.lstActions(1).Text = "(S) Merchant Ship"
			PickActions.lstActions(2).Text = "(S) Island"
			PickActions.lstActions(3).Text = "(S) Tactician"
			PickActions.lstActions(4).Text = "(S) Treasury"
			PickActions.lstActions(5).Text = "(S) Treasure Map"
			PickActions.lstActions(6).Text = "(S) Lighthouse"
			PickActions.lstActions(7).Text = "(S) Haven"
			PickActions.lstActions(8).Text = "(S) Pearl Diver"
			PickActions.lstActions(9).Text = "(S) Lookout"
			
		ElseIf Campaign.scenario_selected = 7 Then 
			num_players = 4
			victory_count = 8
			
			num_actions = 9
			PickActions.lstActions(0).Text = "(S) Navigator"
			PickActions.lstActions(1).Text = "(S) Cellar"
			PickActions.lstActions(2).Text = "(S) Bazaar"
			PickActions.lstActions(3).Text = "(S) Tactician"
			PickActions.lstActions(4).Text = "(S) Treasury"
			PickActions.lstActions(6).Text = "(S) Lighthouse"
			PickActions.lstActions(7).Text = "(S) Haven"
			PickActions.lstActions(8).Text = "(S) Pearl Diver"
			PickActions.lstActions(5).Text = "(S) Lookout"
			
		ElseIf Campaign.scenario_selected = 8 Then 
			num_players = 4
			victory_count = 8
			
			num_actions = 10
			PickActions.lstActions(0).Text = "(S) Navigator"
			PickActions.lstActions(1).Text = "(S) Pearl Diver"
			PickActions.lstActions(2).Text = "(S) Haven"
			PickActions.lstActions(3).Text = "(S) Lookout"
			PickActions.chkCard(63).CheckState = System.Windows.Forms.CheckState.Unchecked
			
			PickActions.chkSetA.CheckState = System.Windows.Forms.CheckState.Unchecked
			PickActions.chkSetB.CheckState = System.Windows.Forms.CheckState.Unchecked
			PickActions.chkSetS.CheckState = System.Windows.Forms.CheckState.Checked
			PickActions.chkSetI.CheckState = System.Windows.Forms.CheckState.Unchecked
			
			For i = 0 To 4
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Estate). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If deck(0, i) = get_id_by_name("Estate") Then deck(0, i) = get_id_by_name("Native Village")
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Estate). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If hand(0, i) = get_id_by_name("Estate") Then hand(0, i) = get_id_by_name("Native Village")
			Next i
			
		ElseIf Campaign.scenario_selected = 9 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			never_buy(get_id_by_name("Province")) = 1
			num_piles_to_exhaust = 4
			
			num_actions = 10
			num_players = 6
			
			num_actions = 10
			PickActions.lstActions(0).Text = "(B) Market"
			PickActions.lstActions(1).Text = "(B) Militia"
			PickActions.lstActions(2).Text = "(B) Village"
			PickActions.lstActions(3).Text = "(B) Smithy"
			PickActions.lstActions(4).Text = "(S) Smugglers"
			PickActions.lstActions(5).Text = "(S) Bridge"
			PickActions.lstActions(6).Text = "(S) Shanty Town"
			PickActions.lstActions(7).Text = "(S) Scout"
			PickActions.lstActions(8).Text = "(S) Conspirator"
			PickActions.lstActions(9).Text = "(S) Pawn"
			
		ElseIf Campaign.scenario_selected = 10 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			never_buy(get_id_by_name("Province")) = 1
			num_piles_to_exhaust = 5
			
			num_players = 5
			num_actions = 10
			
		ElseIf Campaign.scenario_selected = 11 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			never_buy(get_id_by_name("Province")) = 1
			num_players = 4
			num_piles_to_exhaust = 1
			num_actions = 10
			victory_count = 12
			For i = 1 To 3
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				player_names(i) = "Sir " & player_names(i)
			Next i
			For i = 1 To 3
				For j = 0 To 4
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Copper). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If hand(i, j) = get_id_by_name("Copper") Then hand(i, j) = get_id_by_name("Gold")
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Copper). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If deck(i, j) = get_id_by_name("Copper") Then deck(i, j) = get_id_by_name("Gold")
				Next j
			Next i
			
		ElseIf Campaign.scenario_selected = 12 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			never_buy(get_id_by_name("Province")) = 1
			num_players = 6
			num_piles_to_exhaust = 3
			num_actions = 10
			victory_count = 12
			For i = 1 To 5
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				player_names(i) = "Sir " & player_names(i)
			Next i
			
			PickActions.lstActions(5).Text = "Random"
			PickActions.lstActions(6).Text = "Random"
			PickActions.lstActions(7).Text = "Random"
			PickActions.lstActions(8).Text = "Random"
			PickActions.lstActions(9).Text = "Random"
		ElseIf Campaign.scenario_selected = 13 Then 
			num_players = 6
			num_piles_to_exhaust = 5
			num_actions = 10
			victory_count = 12
			PickActions.lstActions(0).Text = "(I) Cutpurse"
			PickActions.lstActions(1).Text = "(S) Pirate Ship"
			PickActions.lstActions(2).Text = "(S) Sea Hag"
			PickActions.lstActions(3).Text = "(B) Thief"
			PickActions.lstActions(4).Text = "(I) Swindler"
			PickActions.lstActions(5).Text = "(I) Minion"
			PickActions.lstActions(6).Text = "(I) Torturer"
			PickActions.lstActions(7).Text = "(B) Witch"
			PickActions.lstActions(8).Text = "(B) Militia"
			PickActions.lstActions(9).Text = "(B) Bureaucrat"
			
		ElseIf Campaign.scenario_selected = 14 Then 
			num_players = 6
			num_piles_to_exhaust = 3
			num_actions = 10
			victory_count = 12
			
		ElseIf Campaign.scenario_selected = 15 Then 
			num_players = 2
			num_piles_to_exhaust = 3
			num_actions = 10
			victory_count = 12
			player_names(1) = "King Asmo"
			
		ElseIf Campaign.scenario_selected = 16 Then 
			num_players = 4
			num_piles_to_exhaust = 3
			num_actions = 10
			victory_count = 12
			PickActions.lstActions(4).Text = "(S) Island"
			PickActions.lstActions(5).Text = "(I) Great Hall"
			PickActions.lstActions(6).Text = "(I) Harem"
			PickActions.lstActions(7).Text = "(I) Nobles"
			PickActions.lstActions(8).Text = "(I) Duke"
			PickActions.lstActions(9).Text = "(B) Gardens"
			
		ElseIf Campaign.scenario_selected = 17 Then 
			num_players = 2
			num_piles_to_exhaust = 3
			num_actions = 10
			victory_count = 12
			player_names(1) = "Death"
			
		ElseIf Campaign.scenario_selected = 18 Then 
			num_players = 4
			num_piles_to_exhaust = 3
			num_actions = 10
			victory_count = 36
			
		End If
	End Sub
	
	Private Function scenario_end_game() As Object
		Dim i, j As Object
		Dim count As Short
		'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		scenario_end_game = 0
		Dim curse As Short
		Dim valid As Object
		Dim total As Short
		If Campaign.scenario_selected = 1 Then
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, 2). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, 1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, 0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If count_all_zones_by_id(0, 0) + 2 * count_all_zones_by_id(0, 1) + 3 * count_all_zones_by_id(0, 2) >= 45 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		ElseIf Campaign.scenario_selected = 2 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, get_id_by_name(Province)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If count_all_zones_by_id(0, get_id_by_name("Province")) > 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
				'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, 2). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, 1). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, 0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			ElseIf count_all_zones_by_id(0, 0) + count_all_zones_by_id(0, 1) + count_all_zones_by_id(0, 2) = 0 Then 
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = -1
			End If
		ElseIf Campaign.scenario_selected = 3 Or Campaign.scenario_selected = 4 Or Campaign.scenario_selected = 9 Or Campaign.scenario_selected = 11 Or Campaign.scenario_selected = 14 Or Campaign.scenario_selected = 15 Then 
			'MsgBox "max player... " & max_player
			If max_player = 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		ElseIf Campaign.scenario_selected = 5 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, get_id_by_name(Ghost Ship)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, get_id_by_name(Pirate Ship)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, get_id_by_name(Merchant Ship)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If count_all_zones_by_id(0, get_id_by_name("Merchant Ship")) + count_all_zones_by_id(0, get_id_by_name("Pirate Ship")) + count_all_zones_by_id(0, get_id_by_name("Ghost Ship")) >= 12 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		ElseIf Campaign.scenario_selected = 6 Then 
			count = 0
			'UPGRADE_WARNING: Couldn't resolve default property of object island_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			For i = 0 To island_count(0) - 1
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(Gold). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If island(0, i) = get_id_by_name("Gold") Then count = count + 1
			Next i
			If count >= 3 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, get_id_by_name(Island)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If count_all_zones_by_id(0, get_id_by_name("Island")) + pile_size(get_id_by_name("Island")) < 3 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = -1
			End If
		ElseIf Campaign.scenario_selected = 7 Then 
			If max_player <> -1 And vps(0) > -11 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		ElseIf Campaign.scenario_selected = 8 Then 
			count = 0
			For j = 0 To 9
				'UPGRADE_WARNING: Couldn't resolve default property of object village_count(0). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For i = 0 To village_count(0) - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If native_village(0, i) = action_cards(j) Then
						count = count + 1
						'UPGRADE_WARNING: Couldn't resolve default property of object village_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						i = village_count(0)
					End If
				Next i
			Next j
			If count = 10 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		ElseIf Campaign.scenario_selected = 10 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			valid = 1
			For i = 1 To num_players - 1
				total = 0
				For j = 0 To num_actions + 6
					'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					total = total + count_all_zones_by_id(i, id_by_pile(j))
				Next j
				'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If total < 35 Then valid = 0
			Next i
			'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If valid = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		ElseIf Campaign.scenario_selected = 12 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			curse = get_id_by_name("Curse")
			'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			valid = 0
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, get_id_by_name(Estate)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If count_all_zones_by_id(0, get_id_by_name("Estate")) > 19 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				valid = 1
				For i = 1 To num_players - 1
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, curse). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(i, curse). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					If count_all_zones_by_id(i, curse) < 1 Or count_all_zones_by_id(i, curse) <= count_all_zones_by_id(0, curse) Then
						'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						valid = 0
					End If
				Next i
			End If
			'UPGRADE_WARNING: Couldn't resolve default property of object valid. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If valid = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		ElseIf Campaign.scenario_selected = 13 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			'UPGRADE_WARNING: Couldn't resolve default property of object count_all_zones_by_id(0, get_id_by_name(Province)). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If count_all_zones_by_id(0, get_id_by_name("Province")) > 4 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		ElseIf Campaign.scenario_selected = 16 Then 
			If max_player > -1 And vps(0) > 74 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		ElseIf Campaign.scenario_selected = 17 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object bridge_built. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			If bridge_built = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
			If CDbl(lblTurn.Text) > 29 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = -1
			End If
		ElseIf Campaign.scenario_selected = 18 Then 
			If max_player > -1 And vps(0) > vps(1) + vps(2) + vps(3) + vps(4) + vps(5) Then
				'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				scenario_end_game = 1
			End If
		End If
		
		' save game
		'UPGRADE_WARNING: Couldn't resolve default property of object scenario_end_game. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		If scenario_end_game = 1 Then
			Call Campaign.unlock_scenario(Campaign.scenario_selected)
		End If
		
	End Function
	
	Private Sub scenario_start_turn()
		Dim r, i As Object
		Dim j As Short
		Dim prev_player As Short
		If Campaign.scenario_selected = 2 Then
			If active_player <> 0 Then
				'MsgBox "Adding thief for " & active_player & " at " & hand_count(active_player)
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				hand(active_player, hand_count(active_player) + 1) = -1
				'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				hand(active_player, hand_count(active_player)) = get_id_by_name("Thief")
			End If
		ElseIf Campaign.scenario_selected = 7 Then 
			If active_player <> 0 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object r. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				r = Int(3 * Rnd())
				'UPGRADE_WARNING: Couldn't resolve default property of object r. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If r = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					hand(active_player, hand_count(active_player) - 1) = get_id_by_name("Witch")
					'UPGRADE_WARNING: Couldn't resolve default property of object r. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				ElseIf r = 1 Then 
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					hand(active_player, hand_count(active_player) - 1) = get_id_by_name("Torturer")
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object hand_count(active_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					hand(active_player, hand_count(active_player) - 1) = get_id_by_name("Sea Hag")
				End If
				
				' msgbox_hand (active_player)
			End If
		ElseIf Campaign.scenario_selected = 9 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hidden(get_id_by_name("Gold")) = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hidden(get_id_by_name("Province")) = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			pile_size(get_id_by_name("Gold")) = 0
			
			If active_player = 1 Then
				For i = 0 To num_actions + 6
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					hidden(i) = 0
				Next i
			Else
				prev_player = (active_player + num_players - 1) Mod num_players
				'UPGRADE_WARNING: Couldn't resolve default property of object gained_count(prev_player). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				For i = 0 To gained_count(prev_player) - 1
					'MsgBox names(gained(prev_player, i)) & " was gained"
					For j = 0 To num_actions + 6
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						If gained(prev_player, i) = id_by_pile(j) Then
							hidden(j) = 1
						End If
					Next j
				Next i
				For j = 0 To num_actions + 6
					If hidden(j) = 1 Then
						hide_supply_card((j))
					End If
				Next j
				
			End If
			
		ElseIf Campaign.scenario_selected = 10 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hidden(get_id_by_name("Gold")) = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hidden(get_id_by_name("Province")) = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			pile_size(get_id_by_name("Gold")) = 0
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hidden(get_id_by_name("Curse")) = 1
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			pile_size(get_id_by_name("Curse")) = 0
			
		ElseIf Campaign.scenario_selected = 11 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hidden(get_id_by_name("Gold")) = 1
			If CDbl(lblTurn.Text) = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				pile_size(get_id_by_name("Duchy")) = 60
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				pile_size(get_id_by_name("Estate")) = 60
			End If
			
		ElseIf Campaign.scenario_selected = 12 Then 
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			hidden(get_id_by_name("Gold")) = 1
			If CDbl(lblTurn.Text) = 1 Then
				'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				pile_size(get_id_by_name("Estate")) = 60
			End If
		ElseIf Campaign.scenario_selected = 14 Then 
			For i = 0 To num_all_actions + 6
				If active_player = 0 Then
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					costs(i) = original_costs(i) + 1
				Else
					'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					costs(i) = original_costs(i)
				End If
			Next i
			Call update_button_text()
		ElseIf Campaign.scenario_selected = 15 Then 
			'If lblTurn.Caption = 1 Then
			'    pile_size(get_id_by_name("Estate")) = 60
			'End If
			For i = 0 To num_all_actions + 6
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				If victory_points(i) > 0 Then
					If active_player = 0 Then
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						costs(i) = original_costs(i) * 2
					Else
						'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
						costs(i) = original_costs(i)
					End If
				End If
			Next i
			Call update_button_text()
		ElseIf Campaign.scenario_selected = 17 Then 
			For i = 0 To num_all_actions + 6
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				pile_size(i) = 20
			Next i
			
		ElseIf Campaign.scenario_selected = 18 Then 
			For i = 0 To num_all_actions + 6
				'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				costs(i) = 0
			Next i
			'UPGRADE_WARNING: Couldn't resolve default property of object get_id_by_name(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
			costs(get_id_by_name("Province")) = 1
			Call update_button_text()
		End If
		
	End Sub
End Class